-2

i have a value

$id=10,12,4,45; //these are ids of all the products in product table

Now I want to show (echo) products' names which are given in this single variable.

something like:

query="SELECT description from product where id ='$id' ";

how to do that. thanks in advance...

Saqib Shahzad
  • 947
  • 12
  • 25

1 Answers1

3

Use find_in_Set()

SELECT description from product where find_in_set(id,'$id')
Fahmi
  • 36,607
  • 5
  • 19
  • 28