For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > February 2007 > IF statement in WHILE statement









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author IF statement in WHILE statement
Matthew Ferry

2007-02-14, 3:58 am

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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com