atbjk Posted April 19, 2006 Share Posted April 19, 2006 i am haveing a problem echoing to the broswer. i am reading from a mysql database and then echoing the results to the browser in a neat table. everything works well when there are 100 records when when i try to echo a 1000 records to the broswer it chokes. I am using firefox and ie to test my script. here is the code i use$results=mysqltalk ('SELECT * FROM `cf_category` ORDER BY cateorgnum ASC );$num_rows=mysql_num_rows($results); for($i=0; $i<$num_rows; $i++) { $row=mysql_fetch_assoc($results); echo '<table><tr><td width="137" valign="top">SAMPLE ROW DAta</td> <td width="425">SAMPLE ROW DAta</td></tr></table>';} Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted April 19, 2006 Share Posted April 19, 2006 [!--quoteo(post=366478:date=Apr 19 2006, 05:14 PM:name=atbjk)--][div class=\'quotetop\']QUOTE(atbjk @ Apr 19 2006, 05:14 PM) [snapback]366478[/snapback][/div][div class=\'quotemain\'][!--quotec--]i am haveing a problem echoing to the broswer. i am reading from a mysql database and then echoing the results to the browser in a neat table. everything works well when there are 100 records when when i try to echo a 1000 records to the broswer it chokes. I am using firefox and ie to test my script. here is the code i use$results=mysqltalk ('SELECT * FROM `cf_category` ORDER BY cateorgnum ASC );$num_rows=mysql_num_rows($results); for($i=0; $i<$num_rows; $i++) { $row=mysql_fetch_assoc($results); echo '<table><tr><td width="137" valign="top">SAMPLE ROW DAta</td> <td width="425">SAMPLE ROW DAta</td></tr></table>';}[/quote]when you say 'chokes', what exactly do you mean? you get an error? firefox crashes? nothing happens?have you tried it in other browsers?altho its not the way i'd personally put your code together, there's nothing actually wrong with it as far as i can see in terms of it working. Quote Link to comment Share on other sites More sharing options...
atbjk Posted April 19, 2006 Author Share Posted April 19, 2006 yes it does not open correctly, first it opens, looks like it working then it looks like it is redirecting/reloading then it says pages can not be displayed i tested it in both browsers. also how would you code it please explain?also i can let you see a live example if you want Quote Link to comment Share on other sites More sharing options...
atbjk Posted April 19, 2006 Author Share Posted April 19, 2006 i found out what the problem was, its had to deal with the max excution time for the script. arround 100 rows to echo to broswer is best number Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 19, 2006 Share Posted April 19, 2006 What redbullmarky meant was instead of looping through your results in a for loop just use a while loop.[code]while($row = mysql_fetch_assoc($results)){ echo '<table><tr><td width="137" valign="top">SAMPLE ROW DAta</td><td width="425">SAMPLE ROW DAta</td></tr></table>';}[/code] Quote Link to comment Share on other sites More sharing options...
Dobakat Posted April 19, 2006 Share Posted April 19, 2006 I belive you are missing a ' in:[code]$results=mysqltalk ('SELECT * FROM `cf_category` ORDER BY cateorgnum ASC );[/code]It should be aa:[code]$results=mysqltalk ('SELECT * FROM `cf_category` ORDER BY cateorgnum ASC' );[/code]well just a mistake I saw... Quote Link to comment 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.