Re: Determining if a MySQL field exists
| From: | David Duong | Date: | Sat, 14 Sep 2002 15:53:07 +0000 |
| Subject: | Re: Determining if a MySQL field exists | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116378@lists.php.net to get a copy of this message | ||
Ah thanx.
"Michael Sims" <mhsims@midsouth.rr.com> wrote in message
news:2t05ousbo7l1hg450idi6d5ocb280rffsn@4ax.com...
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()...