murli800 Posted July 8, 2011 Share Posted July 8, 2011 <table > <tr> <td>Department Id</td> <td>Department Name</td> <td>Status</td> </tr> <tr> <?php while($dep = mysql_fetch_assoc(mysql_query("SELECT * FROM department"))){foreach($dep as $value) {?> <td><?php echo $value;?></td> <?php }}?> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/241426-any-error-in-this-codebrowser-taking-infinite-time-to-refresh-this/ Share on other sites More sharing options...
Pikachu2000 Posted July 8, 2011 Share Posted July 8, 2011 Don't nest all the mysql_* functions; it makes debugging a query next to impossible. The way you have it above, I don't believe it even works at all. $query = "SELECT whatever FROM table"; $result = mysql_query($query); while $array = mysql_fetch_assoc($result) ) { // etc. } Quote Link to comment https://forums.phpfreaks.com/topic/241426-any-error-in-this-codebrowser-taking-infinite-time-to-refresh-this/#findComment-1240171 Share on other sites More sharing options...
The Little Guy Posted July 8, 2011 Share Posted July 8, 2011 every time it comes to the while loop, won't it execute the query again the way he has it, and if there is at least one result it will go back to the start of the while loop again. correct? Quote Link to comment https://forums.phpfreaks.com/topic/241426-any-error-in-this-codebrowser-taking-infinite-time-to-refresh-this/#findComment-1240172 Share on other sites More sharing options...
jcbones Posted July 8, 2011 Share Posted July 8, 2011 Oh, it will work, returning the same row in an infinite loop. Causing the script to timeout, which is why it "takes forever". Quote Link to comment https://forums.phpfreaks.com/topic/241426-any-error-in-this-codebrowser-taking-infinite-time-to-refresh-this/#findComment-1240184 Share on other sites More sharing options...
Pikachu2000 Posted July 8, 2011 Share Posted July 8, 2011 Oh, it will work, returning the same row in an infinite loop. Causing the script to timeout, which is why it "takes forever". Not exactly what I meant by "works" . . . Quote Link to comment https://forums.phpfreaks.com/topic/241426-any-error-in-this-codebrowser-taking-infinite-time-to-refresh-this/#findComment-1240185 Share on other sites More sharing options...
murli800 Posted July 8, 2011 Author Share Posted July 8, 2011 thanx..topic solved Quote Link to comment https://forums.phpfreaks.com/topic/241426-any-error-in-this-codebrowser-taking-infinite-time-to-refresh-this/#findComment-1240186 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.