Hi...there..
Okay I just got problem with my paginating page okay I able to view all the record...so I test the limit record show per page are just "3"..purposedly testing the pagination..the pagination is appear .but .only when i click to show the next record ..it not display the next record...so hope someone out there will point me where is y wrong actually...
here's the code
<?
$dbhostname = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "shopcart";
$db = mysql_connect($dbhostname, $dbusername, $dbpassword);
mysql_select_db($dbname, $db) or die("ERROR: Cannot connect to the database");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>View Record</title>
<style type="text/css">
<!--
.style1 {
font-family: tahoma;
font-weight: bold;
color: #FF6600;
}
.style2 {color: #FFFFFF}
.style3 {color: #ECE9D8}
-->
</style>
</head>
<body>
<div align="center" class="style1">View Records </div>
<p align="center"> </p>
<p align="left">
<?
$page_name="view.php";
if(!isset($start)) {
$start = 0;
}
$eu = ($start - 0);
$limit = 3; // No of records to be shown per page.
$thiss = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
/////////////// WE have to find out the number of records in our table. We will use this to break the pages///////
$query=" SELECT * FROM product ";
$result=mysql_query($query);
echo mysql_error();
$myrecord=mysql_num_rows($result);
if (empty($myrecord)){
?>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p>
<? }else{
/////////// Now let us print the table headers ////////////////
$bgcolor="#f1f1f1";
////////////// Now let us start executing the query with variables $eu and $limit set at the top of the page///////////
$query=" SELECT * FROM product limit $eu, $limit ";
$result=mysql_query($query);
echo mysql_error();
?>
</p>
<p> </p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th bgcolor="#990000" scope="col"><span class="style2">product</span></th>
<th bgcolor="#990000" scope="col"><span class="style2">thumb</span></th>
<th bgcolor="#990000" class="style2" scope="col">image</th>
</tr>
<? while($row = mysql_fetch_array($result))
{
if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';}
else{$bgcolor='#f1f1f1';} ?>
<tr>
<td><div align="center"><? echo " $row[pname]"; ?></div></td>
<td><div align="center"><? echo " $row[thumb]"; ?></div></td>
<td><div align="center"><? echo " $row[image]"; ?></div></td>
</tr>
<? } ?>
<tr>
<td> </td>
<td> </td>
<td><div align="right">
<? } ?>
</div></td>
</tr>
<tr>
<td><? if($back >=0) {
print "<a href='$page_name?start=$back'><font face='Verdana' size='1'>PREV</font></a>";
} ?></td>
<td><div align="center">
<?
$i=0;
$l=1;
for($i=0;$i < $myrecord;$i=$i+$limit){
if($i <> $eu){
echo " <a href='$page_name?start=$i'><font face='Verdana' size='1'>$l</font></a> ";
}
else {
echo "<font face='Verdana' size='2' color=red>$l</font>";}
$l=$l+1;
}
?>
</div></td>
<td><div align="right">
<? if($thiss < $myrecord) {
print "<a href='$page_name?start=$next'><font face='Verdana' size='1'>NEXT</font></a>";
} ?>
</div></td>
</tr>
</table>
<p> </p>
<p align="center"> </p>
</body>
</html>
I'm also attach the php file..so I really need help with it...any help are appreciated...tq again....