I'm am trying to write a query that selects the next record in my database that matches the WHERE condition. I'm having problems getting it right.
The $start_record variable, in the first line, is the value of the current prodID on the page that is collected from the URL. My final goal is to create a link that will go to the next product, but for now, I will settle for the next correct product ID.
Here's my query
$start_record = $_GET['prodid'];
$nextsearch= mysql_query ("
SELECT *
FROM Products
INNER JOIN Type ON Products.typeID=Type.typeID
INNER JOIN Product_Theme_Series_Relationship ON Products.prodID=Product_Theme_Series_Relationship.prodID
INNER JOIN Series ON Product_Theme_Series_Relationship.seriesID=Series.seriesID
INNER JOIN Theme ON Product_Theme_Series_Relationship.themeID=Theme.themeID
WHERE Products.current = 'yes' AND
Type.type = '$prodtype'
ORDER BY Series.series ASC, Type.order, Theme.theme ASC
LIMIT $start_record, 1
") or die (mysql_error());
I know it has something to do with the LIMIT. I can't figure out how to construct it. Any ideas?