Re: how can i tell if a field exists
| From: | elias | Date: | Tue, 07 Aug 2001 13:50:34 +0000 |
| Subject: | Re: how can i tell if a field exists | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61602@lists.php.net to get a copy of this message | ||
Yes!
Try:
<?
if (isset($row["fieldname"]))
echo "value is:" . $row["fieldname"];
?>
"Zippy" <zippy__2k@hotmail.com> wrote in message
news:3b6fc80b.495472@news.php.net...
> hi,
>
> I am having trouble with some data i am retrieving from a mysql
> database.
>
> after a query i am using mysql_fetch_array in a while loop to retrieve
> data. ie;-
>
> $row = mysql_fetch_array($result);
>
> once i have a $row i am getting relevant data i want using;-
>
> $data = $myrow["field_name"];
>
> where "field_name" actually exists but may not be used (null).
>
> the problem is that if it is not used then warnings are generated,
> even if i do;-
>
> if($myrow["field_name"] != null){
> $data = $myrow["field_name"];
> }
>
> it still generates warnings. can any one help?
>
> thanks in advance
>
> scott
>