IF statement in WHILE statement
| From: | Matthew Ferry | Date: | Wed, 14 Feb 2007 04:29:58 +0000 |
| Subject: | IF statement in WHILE statement | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-43076@lists.php.net to get a copy of this message | ||
Hello Everyone,
Got another simple problem here....
I am trying to do a if statement inside a while (mysql_fetch_array)
Here is my code:
if ($link = mysql_tech_array($links)) {
do {
if ($_GET['page'] = "$link[file]") {
$status = 'reg_button.php';
} else {
$status = 'push_button.php';
}
echo "<a href='index.php?page=$link[file]'><img
src='$status?text=$link[name]\n'></a>\n";
} while ($link = mysql_fetch_array($links));
} else {
echo "Link Error";
}
This code loads links across a page. The active page needs to get the PUSH_BUTTON.php file
The loop needs to set the status then do the echo line...then start again for each rows in the
array.
thanks
Matt