August 17th, 2000, 10:45 AM
I am running the following query:
"SELECT name, price, productCode FROM products WHERE id IN '$ids'"
Whenever I run this query, it only returns one row. In one of the tests, $ids contains every number form 142 to 158. But it only returns the product with id of 142. Is there something I am missing or is there an easier way to pull all the products with ids in $ids. $ids contains values that were pulled form another table in the database. Thanks for any help.
August 17th, 2000, 01:45 PM
Is $ids in the format (142,143,144,145,146,147,148,etc)?
The comparison must be a parenthesied <sp?>, comma delimited set for an IN clause
August 17th, 2000, 03:04 PM
Yes, it is a comma delimited list surrounded in parentheses. The query works other than I only get one record return instead of having all the ids in the list returned.
August 17th, 2000, 08:18 PM
Well, you need to remove the single quotes from around $ids, but I don't think that would cause the problem.
August 18th, 2000, 09:03 AM
Thanks, Rod k.
Removing the single quotes fixed it.