gokhul Posted June 16, 2009 Share Posted June 16, 2009 Hello, Can anyone tell me about how to get the results in different pages? Right now, I am getting all the results in a single page, making it difficult for me to go through them. I want to get a particular number of results on a single page. The following is the code which I am using to get the results. $ncols=mysql_num_fields($result);/* How many columns (fields) */ $queryResults = NULL; if( mysql_num_rows($result)>0) { print "<br>"; print "<table cellpadding=0 cellspacing=0 width=100% border=1 bordercolor=skyblue>"; print "<tr>"; for ( $i=0; $i<$ncols; $i++ ) { $column_name=mysql_field_name($result,$i); /* field name */ print "<td align=center><b>".$column_name."</b></td>"; } print "</tr>"; $total=0; while ( $row = mysql_fetch_array($result) ) /* process result row-by-row */ { print "<tr>"; $total++; for ( $i=0; $i<$ncols; $i++ ) { $column_value=$row[$i]; /* field value */ print "<td align=center>".$column_value . "</td>"; } } mysql_free_result($result); } else { echo ("<h3>There is no data pertaining to your request</h3>"); } ?> </table> <br> <br> </form> </div> </td> </tr> </table></td> <td valign="top"> </td> </tr> </table> <table width="648" border="0" cellspacing="0" cellpadding="0"> </table> <br> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/162381-results-in-pages/ Share on other sites More sharing options...
.josh Posted June 16, 2009 Share Posted June 16, 2009 What you want is called pagination. Quote Link to comment https://forums.phpfreaks.com/topic/162381-results-in-pages/#findComment-857113 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.