note 73547 rejected from control-structures.while by bobby
| From: | bobby@php.net | Date: | Wed, 28 Feb 2007 21:17:45 +0000 |
| Subject: | note 73547 rejected from control-structures.while by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123967@lists.php.net to get a copy of this message | ||
Note Submitter: johanoosterhuis407 at hotmail dot com
----
The functie while() has some kind of a bug in it.
If I am using the function while() and also try to connect an mysql loop than he only will display
one loop.
$dbres = mysql_query("SELECT * FROM
partners WHERE
login='{$data->login}'");
while($partner = mysql_fetch_object($dbres)){
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(online) AS online,0
FROM gebruiker WHERE login='{$partner->vriend}'");
$user = mysql_fetch_object($dbres);
if($user->online + 300 > time()){
$status1 = "online";
} else {
$status1 = "offline";
}
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(online) AS online,0
FROM gebruiker WHERE login='{$partner->vriend}'");
$user = mysql_fetch_object($dbres);
if($user->wachttijd_heist + 21600 > time()){
$status2 = "no";
} else {
$status2 = "yes";
}
echo $status1;
echo $status2;
}
anyone got an other option to use the same function: while() -> mysql loop??