FrankieHouse
04-27-2009, 05:55 AM
Hi i'm sure there is any easy answer to this but hopefully someone can point me in the right direction.
I have an array with id numbers, sometimes there are duplicates in the array which is what i want. With these id numbers i'm doing a mysql query and pulling out an image link, the problem is that the results i get back from mysql aren't displaying the duplicates, so say i had 3 id 1's in the array i will only get back 1 image instead of the 3 if you get what i mean.
the code i have so far is this:
$addId = implode(",",$sessProduct);
$getSessionItems = mysql_query("SELECT * FROM products WHERE id IN ($addId)", $connection);
if(!$getSessionItems){
die("Database Query Failed: " . mysql_error());
}
while ($row = mysql_fetch_array($getSessionItems)){
echo $row["image"] . ", " . "</br>";
}
Can anyone tell me how i can get the duplicates as well?
Thanks
I have an array with id numbers, sometimes there are duplicates in the array which is what i want. With these id numbers i'm doing a mysql query and pulling out an image link, the problem is that the results i get back from mysql aren't displaying the duplicates, so say i had 3 id 1's in the array i will only get back 1 image instead of the 3 if you get what i mean.
the code i have so far is this:
$addId = implode(",",$sessProduct);
$getSessionItems = mysql_query("SELECT * FROM products WHERE id IN ($addId)", $connection);
if(!$getSessionItems){
die("Database Query Failed: " . mysql_error());
}
while ($row = mysql_fetch_array($getSessionItems)){
echo $row["image"] . ", " . "</br>";
}
Can anyone tell me how i can get the duplicates as well?
Thanks