RE: [PHP-DB] Inserting Variable Variable?
| From: | Jeff Oien | Date: | Wed, 18 Jul 2001 15:07:42 +0000 |
| Subject: | RE: [PHP-DB] Inserting Variable Variable? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10549@lists.php.net to get a copy of this message | ||
Hi, I'm not quite getting it. If $x is 1 here is what happens.
$varname = "C_First_Name".$x;
echo $$varname;
then $$varname prints as $C_First_Name1. However $C_First_Name1
prints the contents of the variable.
Jeff Oien
> Hi Jeff.
>
> $varname = "C_First_Name".$x;
>
> // e.g. if $x == 3 then ...
> echo $$varname; // ... prints the content of $C_First_Name3
>
> Hope this is what you wanted ?!
>
> Greetinx,
> Mike
>
> Michael Rudel
> - Web-Development, Systemadministration -
> >
> > I want to INSERT a variable like this using MySQL. If I use this
> >
> > \"(${"C_First_Name"}.$x)\",
> > or
> > \"(${C_First_Name}.$x)\",
> > or
> > \"${C_First_Name}.$x\",
> >
> > only the $x gets interpolated in the insertion. If I use
> >
> > \"${"C_First_Name$x"}\",
> >
> > only $C_First_Name get interpolated. Any solutions? Thanks.
> > Jeff Oien
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-db-help@lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> >
>