Re: Arraying JOINED tables

From: Date: Sun, 16 Jun 2002 07:28:17 +0000
Subject: Re: Arraying JOINED tables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19829@lists.php.net to get a copy of this message
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

« previous php.db (#19829) next »