Hi,
Ive already posted regarding this but cant seem to get the script working using the previous suggestions.
Its displaying two product images, but when you click on the next button it displays the same two, the offset is not taking effect. Any ideas anyone?
<?
require("func_connect.php");
connect ("localhost","tantrum");
if(isset($offset)) {
$offset = $offset;
}
else {
$offset = 0;
}
// For 20 rows, use 21
$numrows = 3;
$SQ = "SELECT * FROM products, company WHERE products.cid=$cid AND company.cid=$cid LIMIT
$offset,$numrows";
// print the "Previous" link if offset is NOT 0
if ($offset != 0) {
print "<a href=\"offset.php?cid=1&offset=\" . ($offset - $numrows) . \">Previous</a>\n";
}
// start a counter so you ONLY PRINT $numrows rows
$count = 1;
// now print your rows for this page
$result = @("SELECT * FROM products, company WHERE products.cid=$cid AND
company.cid=$cid");
if (@$data = mysql_fetch_array($result))
{
do {
$title = $data["title"];
$thumbnail = $data["thumbnail"];
$id = $data["id"];
$info = $data["info"];
echo "<a href=\"$PHP_SELF?id=$id&cid=$cid\"><img src=\"$thumbnail\" hspace=\"5\" border=\"1\"
alt=\"$title\"></a>";
$count++;
} while (($data = mysql_fetch_array($result)) && ($count < 3) );
}
else {
echo "</p>No items match your selection</p>.";
}
// finally, see if there is a 21st row. If there IS, then print the NEXT link
if (@$data = mysql_fetch_array($result)) {
print "<a href=\"offset.php?cid=1&offset=" . ($offset + $numrows) . "\">Next</a>";
}
?>
Any help would be greatly appreciated.
Thanks,
dast