in_array is lying to me :(
Posted: Sat Jul 29, 2006 12:47 pm
I don't quite understand what is going on here. I have this code that captures post data and inserts it into a database query based on fields it pulls from a table with a describe query..
The problem is that it's returning true on some fields and false on others even though they all exist. The case is the same, they are all text strings. They are all there
[userName] => myusername
COULD NOT FIND userName Field
[TravelDistance] => 55
FOUND FIELD TravelDistance
Code: Select all
foreach ($this->userAnswers AS $key => $value)
{
if (in_array($key, $this->tableFields))
{
$this->data[$key] = $value;
echo 'FOUND FIELD ' . $key . "<br>";
} else {
echo 'COULD NOT FIND ' . $key . ' Field<br>';
}
}[userName] => myusername
COULD NOT FIND userName Field
[TravelDistance] => 55
FOUND FIELD TravelDistance