Hi All
I am having real problems finding a key in a array, here is the exact code
//$this->fields has data (I debugged it)
//$addField is a string containing a basic name like 'food'
****** This fails ******
if(in_array($addField, $this->fields)) {
return false;
}
****** This works ******
foreach($this->fields as $key => $value) {
if($key === $addField) {
return false;
}
}
****** This is how the $this->fields[] is set ******
//basically its a sql table column grab and puts all the columns
//in the array
$i = 1 (field [0] is the primary key column which I dont need)
while ($i < mysql_num_fields($this->sql->result)) {
$obj = mysql_fetch_field($this->sql->result, $i);
$this->fields[$obj->name] = $row[$i];
$i++;
}
Can anyone help me? I am lost as to why it fails, thanks as I feel like a noob
BBK 🙂