Hi,
I have put the page navigation at the bottom of
I got this code fro some place, and everything working fine, except that they are defining a global variable called "Start" which seems to be not working, it always have a value zero., because of which page navigation not working.. here is the whole code
<?php
$numentries=3;
//declares number of entries per page to display
global $start;
//declares start as a global variable
if(!isset($start))
{
$start=0;
//if start is not set, set it to zero
}
echo "Start value coming as -- $start";
$link = mysql_connect("localhost","root", "786sheikh")
or die("Couldn't make connection.");
mysql_select_db("small_store",$link)
or die("Couldn't select database.");
$result= mysql_query("SELECT * FROM products order by gender DESC LIMIT $start,$numentries")
or die("Couldn't execute query");
while($row = mysql_fetch_array($result)) {
$product_name = $row["product_name"];
$product_image = $row["product_image"];
$product_price = $row["product_price"];
$product_desc = $row["product_desc"];
$size_flag = $row["size_flag"];
echo " <table BORDER='0' CELLPADDING=5 CELLSPACING=0 width=100%><tr><td><table><tr><td valign=top><img src=productimages/$product_image border=0 width=72 height=72 > </td><td valign=top class=HeaderRow2><b>$product_name</b><br><font face=Verdana, Arial, Helvetica, sans-serif size=1 color=black>$product_desc<br><b>Price: </b>$$product_price<br><b>Size: </b>$size_flag</font></td></tr></td></table></tr><tr><td height=3 ></td></tr><TR bgcolor=brown><td valign=TOP HEIGHT=0></TD></TR></table>";
}
$d=0;
$f=0;
$g=1;
$r="SELECT*from products";
$r2=mysql_query($r);
while($order3=mysql_fetch_array($r2))
{
if($f%$numentries==0)
{
print "<A href='products.php?start=$d'>$g</a> ";
$g++; }
$d=$d+1;
$f++;
}
?>
I have put the page navigation at the bottom of
I got this code fro some place, and everything working fine, except that they are defining a global variable called "Start" which seems to be not working, it always have a value zero., because of which page navigation not working.. here is the whole code
<?php
$numentries=3;
//declares number of entries per page to display
global $start;
//declares start as a global variable
if(!isset($start))
{
$start=0;
//if start is not set, set it to zero
}
echo "Start value coming as -- $start";
$link = mysql_connect("localhost","root", "786sheikh")
or die("Couldn't make connection.");
mysql_select_db("small_store",$link)
or die("Couldn't select database.");
$result= mysql_query("SELECT * FROM products order by gender DESC LIMIT $start,$numentries")
or die("Couldn't execute query");
while($row = mysql_fetch_array($result)) {
$product_name = $row["product_name"];
$product_image = $row["product_image"];
$product_price = $row["product_price"];
$product_desc = $row["product_desc"];
$size_flag = $row["size_flag"];
echo " <table BORDER='0' CELLPADDING=5 CELLSPACING=0 width=100%><tr><td><table><tr><td valign=top><img src=productimages/$product_image border=0 width=72 height=72 > </td><td valign=top class=HeaderRow2><b>$product_name</b><br><font face=Verdana, Arial, Helvetica, sans-serif size=1 color=black>$product_desc<br><b>Price: </b>$$product_price<br><b>Size: </b>$size_flag</font></td></tr></td></table></tr><tr><td height=3 ></td></tr><TR bgcolor=brown><td valign=TOP HEIGHT=0></TD></TR></table>";
}
$d=0;
$f=0;
$g=1;
$r="SELECT*from products";
$r2=mysql_query($r);
while($order3=mysql_fetch_array($r2))
{
if($f%$numentries==0)
{
print "<A href='products.php?start=$d'>$g</a> ";
$g++; }
$d=$d+1;
$f++;
}
?>