Re: Newbie mysql question
| From: | Dennis Moore | Date: | Fri, 19 Jul 2002 21:47:12 +0000 |
| Subject: | Re: Newbie mysql question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108585@lists.php.net to get a copy of this message | ||
Or Try:
$dbconn=mysql_connect("your stuff");
$dblink=mysql_select_db($dbname,$dbconn);
$qr="SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER' ";
$rez=mysql_query($qr);
$id=mysql_result($rez,0,"id");
----- Original Message -----
From: "Hans Lellelid" <hans@forumone.com>
To: "John Wulff" <johnw@orcasnet.com>
Cc: <php-general@lists.php.net>
Sent: Friday, July 19, 2002 5:24 PM
Subject: Re: [PHP] Newbie mysql question
> You could do something like:
>
> $query = mysql_query("SELECT id FROM ma_users WHERE
> user='$PHP_AUTH_USER'");
>
> list($id) = mysql_fetch_row($query);
>
> HTH,
> Hans
>
> On Fri, 2002-07-19 at 16:47, John Wulff wrote:
> > If i KNOW this query will only return one "piece" of data, what, php'ly
> > speaking, must i do to assign it to the var $id?
> >
> > SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>