Re: [PHP-DB] Problems with INNER JOIN
Try this: $sql = SELECT admin.AdminID AS adminID, workorders.AdminID AS workadmin FROM admin INNER JOIN workorders ON (admin.AdminID=workorders.AdminID) WHERE admin.UserName = '.$_SESSION['user'].' ; maybe you have to call with different name the table fields Terion Miller ha scritto: Hi Everyone! I am having problems getting an INNER JOIN to work and need some tips trouble shooting where the problem may be. What I'm trying to do is match up AdminID's from two tables and display only that users orders, sounds simple enough right...but I can't get it to return the AdminID... My Query: $sql = SELECT admin.AdminID , workorders.AdminID FROM admin INNER JOIN workorders ON (admin.AdminID=workorders.AdminID) WHERE admin.UserName = '.$_SESSION['user'].' ; $result = mysql_query ($sql); $row = mysql_fetch_assoc ($result); $Total = ceil(mysql_num_rows($result)/$PerPage); Thanks for any tips on how else I can accomplish this... Terion
Re: [PHP-DB] Problems with INNER JOIN
Maybe LEFT instead of INNER? Terion Miller napsal(a): Hi Everyone! I am having problems getting an INNER JOIN to work and need some tips trouble shooting where the problem may be. What I'm trying to do is match up AdminID's from two tables and display only that users orders, sounds simple enough right...but I can't get it to return the AdminID... My Query: $sql = SELECT admin.AdminID , workorders.AdminID FROM admin INNER JOIN workorders ON (admin.AdminID=workorders.AdminID) WHERE admin.UserName = '.$_SESSION['user'].' ; $result = mysql_query ($sql); $row = mysql_fetch_assoc ($result); $Total = ceil(mysql_num_rows($result)/$PerPage); Thanks for any tips on how else I can accomplish this... Terion -- S pozdravem Daniel Tlach Freelance webdeveloper Email: m...@danaketh.com ICQ: 160914875 MSN: danak...@hotmail.com Jabber: danak...@jabbim.cz
Re: [PHP-DB] Problems with INNER JOIN
Terion Miller wrote: Hi Everyone! I am having problems getting an INNER JOIN to work and need some tips trouble shooting where the problem may be. What I'm trying to do is match up AdminID's from two tables and display only that users orders, sounds simple enough right...but I can't get it to return the AdminID... My Query: $sql = SELECT admin.AdminID , workorders.AdminID FROM admin INNER JOIN workorders ON (admin.AdminID=workorders.AdminID) WHERE admin.UserName = '.$_SESSION['user'].' ; $result = mysql_query ($sql); $row = mysql_fetch_assoc ($result); $Total = ceil(mysql_num_rows($result)/$PerPage); Thanks for any tips on how else I can accomplish this... I explained all of this here: http://marc.info/?l=php-generalm=123318173022009w=2 and here: http://marc.info/?l=php-generalm=123318438826250w=2 Which part didn't make sense? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php