mathus Posted July 2, 2007 Share Posted July 2, 2007 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?? Link to comment https://forums.phpfreaks.com/topic/58097-solved-server-timeout-when-printing-query-results/ Share on other sites More sharing options...
trq Posted July 2, 2007 Share Posted July 2, 2007 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>"); } Link to comment https://forums.phpfreaks.com/topic/58097-solved-server-timeout-when-printing-query-results/#findComment-288060 Share on other sites More sharing options...
mathus Posted July 2, 2007 Author Share Posted July 2, 2007 Thank ya much, i knew it would be something simple. Link to comment https://forums.phpfreaks.com/topic/58097-solved-server-timeout-when-printing-query-results/#findComment-288080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.