If I use the following code, I get the error 'Wrong datatype for second argument' on the conditional (last) line:
$query = "SELECT first_name, last_name FROM users WHERE location='$test'";
$result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());
$test_array = mysql_fetch_array ($result, MYSQL_ASSOC);
if (in_array("Ray", $test_array['first_name'])) echo('<p>IN ARRAY</p>');
if I remove ['first_name'] from the conditional line, I get the correct result. This confuses me, because I understand that $test_array is a two dimensional array, consisting of a two member array containing as values user_name and location, both of which are an array of data. If I leave out ['user_name'] it seems that I am referring to the two-dimensional array, when I want to refer only to the first_name column, so that I do not get a match with the last_name column (which may contain "Ray").
How can I refer to the first_name column only, without getting the 'Wrong data type for second argument' error?
Thanks!