jtracey0380 Posted March 11, 2010 Share Posted March 11, 2010 I'll try this one more time. My code returns the results from a query. it also returns the number of results. what i would like the code to do is return 30 results at a time. i need the code to write links for the rest of the results. if my code returns 500 results how would i then list them 30 at a time. <?php $db = mysql_connect('jtracey.fatcowmysql.com', 'bookorama', 'xxdustin'); if (!$db) { echo 'Error: Could not connect to database. Please try again later.'; exit; } mysql_select_db('jtbookorama'); $query = "SELECT `page_info` FROM `pages` ORDER BY `page_name` ASC LIMIT 5 , 5"; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo '<p>Number of items found: '.$num_results.'</p>'; for ($i=0; $i <$num_results; $i++) { $row = mysql_fetch_array($result); echo stripslashes($row['page_info']); echo '<br />'; } ?> Link to comment https://forums.phpfreaks.com/topic/194854-coding-for-returning-results-30-at-a-time/ Share on other sites More sharing options...
jtracey0380 Posted March 11, 2010 Author Share Posted March 11, 2010 I'll try this one more time. My code returns the results from a query. it also returns the number of results. what i would like the code to do is return 30 results at a time. i need the code to write links for the rest of the results. if my code returns 500 results how would i then list them 30 at a time. <?php $db = mysql_connect('mysql_server', 'username', 'password'); if (!$db) { echo 'Error: Could not connect to database. Please try again later.'; exit; } mysql_select_db('jtbookorama'); $query = "SELECT `page_info` FROM `pages` ORDER BY `page_name` ASC LIMIT 5 , 5"; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo '<p>Number of items found: '.$num_results.'</p>'; for ($i=0; $i <$num_results; $i++) { $row = mysql_fetch_array($result); echo stripslashes($row['page_info']); echo '<br />'; } ?> Link to comment https://forums.phpfreaks.com/topic/194854-coding-for-returning-results-30-at-a-time/#findComment-1024551 Share on other sites More sharing options...
xcoderx Posted March 11, 2010 Share Posted March 11, 2010 hmm dont this have something to do with the limit? Link to comment https://forums.phpfreaks.com/topic/194854-coding-for-returning-results-30-at-a-time/#findComment-1024632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.