loganbest Posted August 23, 2010 Share Posted August 23, 2010 I have a shopping cart and I'm trying to add Previous and Next Product buttons. The next prod works fine but the previous is not. SELECT p.product_Name, p.product_ID, i.prdctImage_FileName, it.imgType_Folder FROM tbl_products p INNER JOIN tbl_skus S ON p.product_ID = S.SKU_ProductID LEFT JOIN tbl_prdtimages i ON p.product_ID = i.prdctImage_ProductID LEFT JOIN tbl_list_imagetypes it ON i.prdctImage_ImgTypeID = it.imgType_ID WHERE it.imgType_SortOrder = 1 AND i.prdctImage_ImgTypeID = 1 AND p.product_OnWeb = 1 AND S.SKU_Stock > 0 AND p.product_ID < '2326' LIMIT 1 if product_ID > '2326' it will return 2327 which is correct. if product_ID < '2326' it will return 429, which should be 2325. Link to comment https://forums.phpfreaks.com/topic/211462-less-than-operator-not-working-right/ Share on other sites More sharing options...
Pikachu2000 Posted August 23, 2010 Share Posted August 23, 2010 You'll need to add an ORDER BY . . . DESC clause. Link to comment https://forums.phpfreaks.com/topic/211462-less-than-operator-not-working-right/#findComment-1102541 Share on other sites More sharing options...
loganbest Posted August 23, 2010 Author Share Posted August 23, 2010 sweet. Thanks. Link to comment https://forums.phpfreaks.com/topic/211462-less-than-operator-not-working-right/#findComment-1102546 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.