RE: [PHP] Variable question
| From: | John Vanderbeck | Date: | Mon, 07 May 2001 20:01:25 +0000 |
| Subject: | RE: [PHP] Variable question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51814@lists.php.net to get a copy of this message | ||
I'm not sure what you mean...
[code]
$query = "SELECT username FROM Users WHERE userid=1";
$result = mysql_query($query, $link);
$user_data = mysql_fetch_assoc($result);
echo "my user name is ".$user_data["username"];
[/code]
Is that _not_ what you mean?
- John Vanderbeck
- Admin, GameDesign (http://gamedesign.incagold.com/)
- GameDesign, the industry source for game design and development issues
> -----Original Message-----
> From: King, Justin [mailto:KingJ@superior.k12.wi.us]
> Sent: Monday, May 07, 2001 3:58 PM
> To: php-general@lists.php.net
> Subject: RE: [PHP] Variable question
>
>
> I think you're misunderstanding my question. I'm pulling
> $user_data["username"] from a databse so the string my user name is
> $user_data["username"]" is exactly as the database hands it to me. I
> know how to simply concat information.
>
> -Justin
>
> -----Original Message-----
> From: "Jack Dempsey" <dempsejn@georgetown.edu>
> Sent: Monday, May 07, 2001 12:55 PM
> To: King, Justin; php-general@lists.php.net
> Subject: RE: [PHP] Variable question
>
> you can do it a couple ways...
>
> echo "my user name is " . $user_data["username"];
>
> or
>
> echo "my username is ${user_data["username"]}";
>
> -----Original Message-----
> From: King, Justin [mailto:KingJ@superior.k12.wi.us]
> Sent: Monday, May 07, 2001 3:49 PM
> To: php-general@lists.php.net
> Subject: [PHP] Variable question
>
>
> How can I evaluate a variable in a string? For example if I have a
> string defined as "my user name is $user_data["username"]", how do I
> echo that string and have php evaluate $user_data["username"].
>
> Thanks in advance..
>
> -Justin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>