Re: [[PHP-DB] Variable Assignment]
| From: | Ron Patterson | Date: | Wed, 02 May 2001 17:54:11 +0000 |
| Subject: | Re: [[PHP-DB] Variable Assignment] | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9064@lists.php.net to get a copy of this message | ||
Assuming this may be MySQL, use a mysql_fetch_object like:
$result=mysql_query($sql);
$r=mysql_fetch_object($result);
echo $r->real_name;
Other databases have similar syntax.
Hope this helps,
Ron Patterson
USA.NET
"Rankin, Randy" <randy.rankin@smith-blair.com> wrote:
> All:
>
> I am new to PHP and was hoping for some input to what is probably an 'easy'
> question.
>
> The following SQL statement returns 1 row:
>
> $sql = "SELECT id, real_name FROM authorization WHERE username='$username'
> and password='$password'";
>
> All I want to do is assign the results of the field real_name to a variable
> called $salesperson, but I cannot seem to get it to work.
>
> Thanks inadvance for your help,
>
> Randy Rankin
>
>
>
>
>
> --
> 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
>
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1