Re: MySQL - field names
| From: | David Robley | Date: | Wed, 16 Aug 2000 01:28:17 +0000 |
| Subject: | Re: MySQL - field names | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11897@lists.php.net to get a copy of this message | ||
On 15 Aug, o.cook@etoncollege.org.uk 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