The objective is that matched ids are removed, returning the remaining values in an array.
This is my script:
function example($link, $onlist)
{
//$newarray = array();
$newarray = implode(',', $onlist);
foreach ($newarray as $key)
{
$query = mysql_query("select * from table where id = '".$newarray."'");
$existing = array();
while($cz = mysql_fetch_assoc($query))
{
$existing[] = $cz['id'];
}
}
$ex = array_diff($newarray, $existing);
return $ex;
}
If I run this script. It shows errors:
PHP Warning: array_diff(): Argument #1 is not an array Warning: Invalid argument supplied for foreach() .
Please share suggestions with me.