Gamenati
03-12-2003, 09:03 PM
I am trying to make a sort of a display results thing and i decided to practice on a table called 'news'. Each page shows 5 results. My question is how can i make the next page show the next 5 results. www.gamenationx.com/testes.php
here is the code so far:
<?php
$link_id = mysql_connect ("localhost", "gamenat_admin", "rmb1990") or
die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("gamenat_everything");
$records_per_page = "5" ;
$sql = "SELECT newsid FROM news LIMIT 5";
$query = mysql_query($sql);
$query2 = "SELECT count(*) FROM news" ;
$result = mysql_query($query2) ;
$querydata = mysql_fetch_row($result);
$total_num_news = $querydata[0] ;
$total_pages = ceil($total_num_news/$records_per_page) ;
$page_num = $cur_page + 1;
echo "Page $page_num out of $total_pages<br><br>";
while ($query_data = mysql_fetch_array($query)) {
echo $query_data[newsid] . "<br>" ;
}
?>
hope i made sense
here is the code so far:
<?php
$link_id = mysql_connect ("localhost", "gamenat_admin", "rmb1990") or
die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("gamenat_everything");
$records_per_page = "5" ;
$sql = "SELECT newsid FROM news LIMIT 5";
$query = mysql_query($sql);
$query2 = "SELECT count(*) FROM news" ;
$result = mysql_query($query2) ;
$querydata = mysql_fetch_row($result);
$total_num_news = $querydata[0] ;
$total_pages = ceil($total_num_news/$records_per_page) ;
$page_num = $cur_page + 1;
echo "Page $page_num out of $total_pages<br><br>";
while ($query_data = mysql_fetch_array($query)) {
echo $query_data[newsid] . "<br>" ;
}
?>
hope i made sense
