[PHP] array variables with or without quotes

2006-02-21 Thread 2dogs
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 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: array variables with or without quotes

2006-02-22 Thread 2dogs
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" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 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.
> * 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Phone number validation

2006-03-12 Thread 2dogs

""Paul Goepfert"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
I didn't realize that those were single quotes.  I printed out the
email message and it looked like one set of double quotes for the
second parameter rather the two single quotes.

Is it possible for anyone to tell me what php method is used to grab
the first charater of a string?  And onece I have it what method
removes the characted or number?

I know this seems trivial but I am still new to php and I don't have a
good understanding of the language yet.  The more I do the better I'll
get.

Thanks
Paul

check out this page of the php manual for a few ideas. See the section
"String access and modification by character"

http://www.php.net/manual/en/language.types.string.php 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ignore this test

2006-02-18 Thread 2dogs
just testing my news connection 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php