Re: Making a Variable from different tables with Matching Db fields?
| From: | Terion Miller | Date: | Wed, 28 Jan 2009 20:25:12 +0000 |
| Subject: | Re: Making a Variable from different tables with Matching Db fields? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287301@lists.php.net to get a copy of this message | ||
Wow I got it !! Well I now have the AdminID variable to work with!! If I
wasn't so tired and brain dead from marathoning this project because I'm so
so So SICK of it, I would get up and do the happy dance....
On Wed, Jan 28, 2009 at 2:18 PM, Terion Miller <webdev.terion@gmail.com>wrote:
> Not sure if I'm wording this right, what I am trying to do is look in two
> tables, match the ID to use to pull information....
>
> Here's my code but it's not right, although it is picking up the user from
> the session, I will also post what my variable debugging lists:
>
> $query = "SELECT admin.AdminID, workorders.AdminID FROM admin,
> workorders WHERE admin.UserName = '".$_SESSION['user']."'
> ";
> $result = mysql_query ($query);
> $row = mysql_fetch_assoc ($result);
>
> echo $row['AdminID'];
>
> if ($row['ViewMyOrders'] == "NO") {
> header ("Location: Welcome.php?AdminID=$AdminID&msg=Sorry, you do
> not have access to that page.");
> }
>
> *Also tried this to pull just this persons orders:*
>
> $sql = "SELECT workorders.WorkOrderID , workorders.AdminID,
> admin.AdminID FROM workorders, admin WHERE workorders.AdminID =
> admin.AdminID ";
> $result = mysql_query ($sql);
>
> Thanks for looking, t.
>