[suspicious - maybe spam] [suspicious - maybe spam] SELECT probrem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have an array, for ex: $products=array(1, 2,  5 , 7)

I want to select all products from the database that has the ids of products.
I use this but doesn't work:

$sql = '';
foreach($products AS $products_id){
if(strlen($sql)){ $sql .= ' OR '; }
$sql .= "product_id = '$products_id'";
}
      
$sql2 = "SELECT product_name FROM accessories WHERE " .$sql;

Please help me !!!!

Thanks

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux