Jump to content

[SOLVED] server timeout when printing query results


mathus

Recommended Posts

by the level to which this issue is irritating me, it must be something simple.

 

All im trying to do is a simple SELECT query. nothing strange about it.

 

$sql = "SELECT wdate, wtype, wreason, wmemo FROM empwarn WHERE l_name = '$name'";
$res = mysqli_query($mysqli, $sql);
	 if($res == true) {
		$list = mysqli_fetch_array($res);
		while($list) {
		printf("<td>".$list['wdate']."</td> <td>".$list['wtype']."</td> <td>".$list['wreason']."</td> <td>".$list['wmemo']."</td> </tr>");

		}


	}

 

thats it. but when i run the query i get this:

The connection was reset

The connection to the server was reset while the page was loading.

 

anybody have an idea where to look??

This...

 

while($list) {
  printf("<td>".$list['wdate']."</td> <td>".$list['wtype']."</td> <td>".$list['wreason']."</td> <td>".$list['wmemo']."</td> </tr>");
}

 

Is an infinant loop because $list will always be true. You need to use....

 

while($list = mysqli_fetch_array($res)) {
  printf("<td>".$list['wdate']."</td> <td>".$list['wtype']."</td> <td>".$list['wreason']."</td> <td>".$list['wmemo']."</td> </tr>");
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.