Hi, I have been trying so hard to make this code work but currently,it displays 10 records, but the previous, next and the page number links are not there at all,could someone please help me with it??the table displays 10 records in the table just fine but the links are not there. even the bgcolor is not there..
here's the code
<?php //script 1.07 viewusers.php
//this will retrieve all records from the user's table... this is t
echo "<h1>COMMUNITY</h1>";
require_once('esther.php');
$display=10; //setting the number of records to display per page
//check if the number of pages is set
if (isset($_GET['p']) && is_numeric($_GET['p']))
{
$pages=$_GET['p'];
}
else
{
$q="SELECT COUNT(memberID) FROM emember";
$r=@mysqli_query($dbc,$q);
$row=@mysqli_fetch_array($r,MYSQLI_NUM);
$records=$row[0];
if ($records>$display) //this is to determine the number of records per page
{
$pages=ceil($records/$display);
}
else
{
$pages=1;
}
}
if (isset($_GET['s']) && is_numeric($_GET['s']))
{
$start=$_GET['s'];
}
else
{
$start=0;
}
$q="SELECT firstName,lastName,DATE_FORMAT(createDate,'%M,%D,%Y')AS dr,memberID from emembers ORDER BY createDate ASC LIMIT $start,$display";
$r=@mysqli_query($dbc,$q);
//create table to handle data..
echo '<table align="centre" cellspacing="0" cellpadding="5" width="75%">
<tr>
<td align="left"><b>Edit</b></td>
<td align="left"><b>Delete</b></td>
<td align="left"><b>Last Name</b></td>
<td align="left"><b>First Name</b></td>
<td align="left"><b>Date Registered</b></td>
</tr>';
$bg="#eeeeee"; //initialise the color variable
//initiate the loop that will handle the alternating colors-ie white and black.
while ($row=mysqli_fetch_array($r,MYSQLI_ASSOC))
{
$bg=($bg=='#eeeeee'?'#ffffff':'#eeeeee');
//print the records in a form data
echo '<tr bgcolor="'.$bg.'">
<td align="left"><a href=edituser.php?id='.$row['memberID'].'>EDIT</a></td>
<td align="left"><a href=deleteuser.php?id='.$row['memberID'].'>DELETE</a></td>
<td align="left">'.$row['lastName'].'</td>
<td align="left">'.$row['firstName'].'</td>
<td align="left">'.$row['dr'].'</td>
</tr>';
}
echo '</table>';
mysqli_free_result($r);
mysqli_close($dbc);
//begin section to display links to other pages if nessesary..
if ($pages>1)
{
echo '<br /><p>';
$current_page=($start/$display)+1;
if ($current_page != 1)
{
echo '<a href="viewuser3.php?s='.($start-$display).'&p='.$pages.'">previous</a>';
}
for ($i=1;$i<=$pages;$i++)
{
if ($i!=$current_page)
{
echo '<a href="viewuser3.php?s='.(($display*($i-1))).'$p'.$pages.'">'.$i.'</a>';
}
else {echo $i.' ';}
}
if ($current_page!=$pages)
{
echo '<a href="viewuser3.php?s='.($start+$display).'&p='.$pages.'">next</a>';
}
echo '</p>';
}
?>