I seem to be having a problem checking if a string exists in my array. There is probably a really obvious answer to my question do forgive me but I'm new to PHP.
Anyway here is my code:
while($row = mysql_fetch_assoc($result))
{
$result_array[] = $row;
}
if (in_array("496891", $result_array))
{
echo "true";
}
else
{
echo "false";
}
The array looks like this:
Array ( [0] => Array ( [ID] => 496891 ) [1] => Array ( [ID] => 1177953 ))
My code always echoes false. Anyone know what I'm doing wrong?
Thanks