php array in sql code example
Example 1: php in array
$colors = array("red", "blue", "green");
if (in_array("red", $colors)) {
echo "found red in array";
}
Example 2: php array
<?php
$array = array("foo", "bar", "hello", "world");
var_dump($array);
?>
Example 3: implode in sql query
$sql = "SELECT * FROM table WHERE comp_id IN ('"
. implode("','", array_map('mysql_real_escape_string', $arr))
. "')";