Re: Making a Variable from different tables with Matching Dbfields?
| From: | Shawn McKenzie | Date: | Wed, 28 Jan 2009 22:27:19 +0000 |
| Subject: | Re: Making a Variable from different tables with Matching Dbfields? | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287329@lists.php.net to get a copy of this message | ||
> Here are my variables when I reveal them, I am picking up the right
> adminID I can't figure out why it's returning random orders though:
> $query "SELECT admin.AdminID, workorders.AdminID FROM admin,
> workorders WHERE admin.UserName = 'tmiller' "
> $result "Resource id #5"
> $row
> key value
> [WorkOrderID] "44"
> [AdminID] "7"
>
> $SortBy "WorkOrderID DESC"
> $Page "2"
> $PerPage "30"
> $StartPage "30"
> $sql "SELECT workorders.WorkOrderID, workorders.AdminID,
> admin.AdminID FROM workorders, admin WHERE workorders.AdminID =
> admin.AdminID "
> $Total "3"
>
>
Because your queries are hosed. You want to populate $row with what?
If you want all the fields in workorders, then this works great:
SELECT * FROM workorders WHERE AdminID = 7
-Shawn