I have a dynamic array. For example like this.
$color = array('red','blue','green');
"SELECT * FROM mytable where colors=(red or blue or green)"
But my array is dynamic. So I don't know the values and how can I loop the array and select the rows.
I have a dynamic array. For example like this.
$color = array('red','blue','green');
"SELECT * FROM mytable where colors=(red or blue or green)"
But my array is dynamic. So I don't know the values and how can I loop the array and select the rows.
try this
<?php
$color = array('red','blue','green');
$ss = 'SELECT * FROM mytable where colors IN ("' . implode('", "', $color ) . '")';
output :
SELECT * FROM mytable where colors IN ("red", "blue", "green")
?>