Re: Making a Variable from different tables with Matching Dbfields?
| From: | Shawn McKenzie | Date: | Thu, 29 Jan 2009 01:39:59 +0000 |
| Subject: | Re: Making a Variable from different tables with Matching Dbfields? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287349@lists.php.net to get a copy of this message | ||
Chris wrote:
>
>> The main problem is that you've never explained what you want to get
>> from the query. The replies have used your code as an example and I'm
>> pretty sure that's not what you want. Unless I totally mis-understand
>> what you want, you have 2 options:
>>
>> 1. Use the 2 queries that I gave you in a previous post.
>> 2. Use a subquery:
>>
>> $sql = "SELECT * FROM workorders WHERE AdminID = (SELECT AdminID FROM
>> admin WHERE UserName = '" .
>> mysql_real_escape_string($_SESSION['user']) . "')";
>
> 3 - fix the join ;)
>
Yes, however, I'm going out on a limb here because we don't really know
what he wants - he is only getting admin.AdminID, workorders.AdminID
returned in all of the queries I've seen. I'm assuming that he wants
some of the workorder details.
--
Thanks!
-Shawn
http://www.spidean.com