Re: Determining if a MySQL field exists

From: Date: Sat, 14 Sep 2002 00:35:50 +0000
Subject: Re: Determining if a MySQL field exists
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-116335@lists.php.net to get a copy of this message
On Fri, 13 Sep 2002 18:15:02 -0600, you wrote: [snip] > for ($i = 0; $i < $columns; $i++) { > $fields[] = mysql_field_name($result, $i); > } > > if ($mysql[0] == 1 && array_key_exists($key, $fields)) ... array_key_exists() checks to see if a KEY exists, not a value. You are assigning the field names as values of the $fields array. Give it a shot with in_array() instead of array_key_exists()...

« previous php.general (#116335) next »