RE: [SMARTY] Smarty error on PHP include
| From: | Scott Matthewman | Date: | Thu, 21 Nov 2002 12:40:20 +0000 |
| Subject: | RE: [SMARTY] Smarty error on PHP include | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6487@lists.php.net to get a copy of this message | ||
It looks a PHP error rather than a Smarty error, caused by how PHP parses
associative arrays when they're within text strings. Either remove the
single quotes, or enclose $row['account_name'] within braces {}.
Scott
> -----Original Message-----
> From: Sonny2@gmx.de [mailto:Sonny2@gmx.de]
> Sent: 21 November 2002 12:35
> To: smarty-general@lists.php.net
> Subject: [SMARTY] Smarty error on PHP include
>
>
> Hello,
>
> I get the following error:
> Fatal error: Smarty: [in search_casedata.tpl line 25]: syntax
> error: invalid
> attribute name - '"$row[account_name]";' in
> /www-1/src/php/lib/php/Smarty_Compiler.class.php on line 1398
>
> On the errored line i have following:
> { php }
> /*
> * Get Account infos from DB
> */
> $sql = "SELECT account_name,account_code from
> account order by
> account_name";
> $query = $db->sql_query($sql);
> while ( $row = $db->sql_fetchrow($query) ) {
> echo "<option
>
> value=\"".$row['account_code']."\">$row['account_name']</option>\n";
> }
> $db->sql_freeresult($query);
> { /php }
>
> Why does this not work ?
> I use SMARTY 2.3.1 with PHP 4.2.2.
>
> Thx in forward.
>
> Peter
>
> --
> +++ GMX - Mail, Messaging & more http://www.gmx.net +++
> NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>