Re: Need syntax for conditional in recordset loop
| From: | Dobromir Velev | Date: | Tue, 17 Jul 2001 06:37:32 +0000 |
| Subject: | Re: Need syntax for conditional in recordset loop | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-10510@lists.php.net to get a copy of this message | ||
Hi,
You could use something like
#start
do
{
echo "<tr>";
$fields=odbc_num_fields($data2);
for($i=3 ; $i<=$fields ; $i++)
echo "<td nowrap>";
if (odbc_result($data2,$i) = 'SOX')
echo "<a
href='sox_page_url'>".odbc_result($data2,$i)."</a>";
else
echo odbc_result($data2,$i);
echo "</td></tr>\n";
} while(odbc_fetch_row($data2));
echo "</table>";
#end
The idea is to output one thing when the result matches your criteria and
another when it doesn't.
Hope this helps
Dobromir Velev
-----Original Message-----
From: John A DAVIS <John.A.DAVIS@state.or.us>
To: php-db@lists.php.net <php-db@lists.php.net>
Date: Tuesday, July 17, 2001 2:39 AM
Subject: [PHP-DB] Need syntax for conditional in recordset loop
How would I code "IF .odbc_result($data2,$i) = 'SOX' THEN make it a link"?
By link I mean that I want the word "SOX" highlited in blue and underlined
and referencing a webpage that explains SOX verbosefully. Don't know PHP IF
THEN syntax too well.
/* fill table with data */
do
{
echo "<tr>";
$fields=odbc_num_fields($data2);
for($i=3 ; $i<=$fields ; $i++)
echo "<td nowrap>".odbc_result($data2,$i)."</td>";
echo "</tr>\n";
} while(odbc_fetch_row($data2));
echo "</table>";
John A. Davis
Information Systems Specialist
OHD DWP
State of Oregon
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net