Re: [PHP] MySQL - field names From: David Robley (huntsman <email protected>)
Date: 08/15/00

On 15 Aug, o.cook <email protected> wrote:
> Calling them in this way *seems* to be causing problems. For example:
>
> echo "<br>".$rs['type'];
>
> works correctly, whereas,
>
> echo "<br>$rs['type']";
>
> results in this error:
>
> Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
> `T_NUM_STRING' in /path/to/file.php3 on line 9
>
> replacing $rs['type'] for $rs[0] (as before) makes both work.
>
> Am I missing something here? :)
>
> Ollie

Nope - that's expected behaviour. One of the developers can probably put
it better, but its a case of only simple variables being expanded in a
double quoted string. You need to concateneat complex variables with
strings as in your first example.

Cheers

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>