Re: array variables with or without quotes
| From: | 2dogs | Date: | Thu, 23 Feb 2006 03:08:05 +0000 |
| Subject: | Re: array variables with or without quotes | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230929@lists.php.net to get a copy of this message | ||
Chuck, you are the man! I decided to reread the manual word for word but
have only gotten through Strings as of last night. Thanks for zeroing me in
on the right spot.
txs
2dogs
"Chuck Anderson" <hairtwoday@gmail.com> wrote in message
news:34.21.50685.8C9CCF34@pb1.pair.com...
> 2dogs wrote:
>
>>I recently encountered a situation where I had to retrieve data from a
>>MYSQL database table with a field named "include". My code looked like
>>this:
>>
>>$content_result = mysql_query('SELECT * FROM calander') or
>>die(mysql_error());
>>$content_row = mysql_fetch_array($content_result);
>>if ($content_row[include])
>> {go do something;}
>>
>>When I tried to run this, PHP treated the word -include- as a control
>>structure rather than an index name. Understandable. So, I put it in
>>single quotes ('include') to see what would happen and it works fine. But
>>I don't understand why!
>>
>>What is the difference between $content_row [include] and
>>$content_row['include']? I have been unable to resolve this question in
>>the php manual, I need enlightenment.
>>
>>2dogs
>
> http://www.php.net/manual/en/language.types.array.php#language.types.array.foo-bar
>
> --
> *****************************
> Chuck Anderson Boulder, CO
> http://www.CycleTourist.com
> Integrity is obvious.
> The lack of it is common.
> *****************************