Say you are given the following array of ids:
<?php $vals = array ( [0] => 1 [1] => 2 [2] => 5 ) ?>
And you want to run a sql query to retrieve rows where the id is in this array.
<?php $ids = join(',' , $vals); $sql = "SELECT * FROM galleries WHERE id IN ($ids)"; ?>
0 comments:
Post a Comment