Re: Problems with INNER JOIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will work:

$sql = "
SELECT admin.AdminID, workorders.WHAT_YOU_WANT
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='".$_SESSION['user']."'
";


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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux