MySQL Query Error
Posted on 2012-03-13
So I'm having an issue with the query below... it was created by my app developer but she is on maternity leave and is unreachable at the moment. This mysql query is linked to two tables for an online shopping site along with several fields. It was originally written to randomly pull product ids and post 4 of them into an image slider (through jquery and css) i believe. What I am trying to accomplish is to alter the code in order to specify which products i want to include in the slide show. I have been trolling forums and trying different things but they all seem to lead to an error... if someone could perhaps give me an idea of what I would need to change to specify the products that are being chosen that would be great. Thanks! ...an example of the random pull is written below:
$sliderid1 = 1;
$sql = "
SELECT products_image, products_price, products_description, products_name, " . TABLE_PRODUCTS . ".products_id
FROM " . TABLE_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . "
WHERE " . TABLE_PRODUCTS . ".products_id = " . TABLE_PRODUCTS_DESCRIPTION . ".products_id
ORDER BY RAND()
LIMIT 0 , 30";
$sql = $db->bindVars($sql, ':sliderid1:', $sliderid1, 'integer');
$result1 = $db->Execute($sql);