everything in this script seems correct, and ive tried it so many ways, using different commands, with and without use_result, but when i try to get it to output to screen, the server times out. Its localhost, and i'm the only one accessing it. i just don't get it.
$sql = "SELECT wdate, wtype, wreason, wmemo FROM empwarn WHERE l_name = '$name'";
$res = mysqli_query($mysqli, $sql);
if($res == true) {
echo "good";
$num = mysqli_num_rows($res);
echo $num;
$list = mysqli_fetch_array($res);
mysqli_use_result($list);
while($list) {
echo "<td>".$list['wdate']."</td><td>".$list['wtype']."</td><td>".$list['wreason']."</td><td>".$list['wmemo']."</td></tr>";
}
}
$sql = "SELECT wdate, wtype, wreason, wmemo FROM empwarn WHERE l_name = '$name'";
$res = mysqli_query($mysqli, $sql);
if($res == true) {
echo "good";
$num = mysqli_num_rows($res);
echo $num;
$list = mysqli_fetch_array($res);
mysqli_use_result($list);
while($list) {
echo "<td>".$list['wdate']."</td><td>".$list['wtype']."</td><td>".$list['wreason']."</td><td>".$list['wmemo']."</td></tr>";
}
}
-
Re: tearing my hair out
Wed, July 4, 2007 - 1:11 PMNot sure. I would do
while ( $list = mysqli_fetch_row( $res ) ) {
....
}
but I can't really do an honest test of your code w/out the database part. -
-
Re: tearing my hair out
Thu, July 5, 2007 - 5:39 AMas it turns out that was it. twas as simple as i thought, created an infinite loop for myself
thanks guys
-
-
Re: tearing my hair out
Thu, July 5, 2007 - 1:47 AMAssuming you don't have a debugger to run through the code with, a simple solution would be to add a flush() after every echo so that you can see how far you get in the script. If the while loop isn't terminating, you should see that easily enough.