Submerged
02 Dec 2006, 12:36 AM
I think I am just messing up the syntax of the IN() function in this where clause:
<?
$array[1] = '1';
$array[2] = '2';
$implode = implode("','",$array);
$query = "SELECT * FROM `sites` WHERE IN '('$implode')' ORDER BY rating DESC";
?>
Query prints out as:
SELECT * FROM `sites` WHERE IN '('1','2')' ORDER BY rating DESC
It should print out several hundred entries from my database, and I've tested enough code with this script to know that the entries themselves aren't the problem. It's just when I added the "IN()" part that it screwed up. Probably something simple :) Thanks!
-Submerged
<?
$array[1] = '1';
$array[2] = '2';
$implode = implode("','",$array);
$query = "SELECT * FROM `sites` WHERE IN '('$implode')' ORDER BY rating DESC";
?>
Query prints out as:
SELECT * FROM `sites` WHERE IN '('1','2')' ORDER BY rating DESC
It should print out several hundred entries from my database, and I've tested enough code with this script to know that the entries themselves aren't the problem. It's just when I added the "IN()" part that it screwed up. Probably something simple :) Thanks!
-Submerged