RE: [PHP-DB] Arraying JOINED tables <--- SOLVED
| From: | César Aracena | Date: | Sun, 16 Jun 2002 08:13:20 +0000 |
| Subject: | RE: [PHP-DB] Arraying JOINED tables <--- SOLVED | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19831@lists.php.net to get a copy of this message | ||
Thanks a lot. It was an error... a HUGE one though :-)
César Aracena
IS / MCSE+I
Neuquén, NQN
(0299) 156-356688
(0299) 446-6621
> -----Mensaje original-----
> De: Denis Arh [mailto:denis@exonium.net]
> Enviado el: Domingo, 16 de Junio de 2002 04:28 a.m.
> Para: php-db@lists.php.net
> Asunto: Re: [PHP-DB] Arraying JOINED tables
>
> Try find out if you have an error in your query, like this:
>
> $query = "SELECT * FROM logins,auth WHERE logins.authname = $variable1
> AND auth.authid = $variable2";
> if ( $result = @mysql_query($query) ) {
> $row = mysql_fetch_array($result);
> }
> else {
> echo mysql_error();
> }
>
> and the other thing... maybe you have fields in both table logins and
auth
> with the same name
>
>
> Denis Arh
>
>
>
> ----- Original Message -----
> From: "César Aracena" <caracena@infovia.com.ar>
> To: "PHP DB List" <php-db@lists.php.net>
> Sent: Sunday, June 16, 2002 8:59 AM
> Subject: [PHP-DB] Arraying JOINED tables
>
>
> Hi all. Hope you're all alright since I don't see any of you writing
for
> some time now ;-)
>
> This should be an easy one for all of you. I want to make a basic
SELECT
> query from two tables and fetch all the results into one array. I'm
> doing it like this:
>
> $query = "SELECT * FROM logins,auth WHERE logins.authname = $variable1
> AND auth.authid = $variable2";
> $result = mysql_query($query);
> $row = mysql_fetch_array($result);
>
> and I get: Warning: Supplied argument is not a valid MySQL result
> resource in blah blah.
>
> What am I doing wrong? Thanks in advance,
>
> Cesar Aracena <mailto:webmaster@icaam.com.ar>
> CE / MCSE+I
> Neuquen, Argentina
> +54.299.6356688
> +54.299.4466621
>
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php