Re: Making a Variable from different tables with Matching Dbfields?

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

 




Terion Miller wrote:
> Hi Guys! Well I tried the INNER JOIN and still can not get it to echo
> the AdminID so I know it isn't working, (what kind of things should I
> think about that could make it not work)  so far the only query that
> did work and return the AdminID was my original I believe it was
> referred to as "hosed" query, yet then it was explained to me that
> query while picking up the AdminID was then returning all the rows
> from workorders anyways because I needed the INNER JOIN, so since that
> isn't working, I'm thinking my best and fastest route ( I have until
> Monday on this project and this is just one bit of it OUCH)  is to use
> my hosed query then somehow use the resulting AdminID to fetch the
> orders from the workorders table, question is , would that be a sub
> query, or do I just make the query results for AdminID a variable to
> use in another query?
> Thanks guys and ps. I'm a she not a he, funny that coders are
> primarily always assumed to be guys...lol
> Facebook Me:
> http://www.facebook.com/profile.php?id=1542024891&ref=name
> <http://www.facebook.com/profile.php?id=1542024891&ref=name>
So the subquery that I gave you doesn't work?  Run it and then do a
print_r($row); and post what you get.

-Shawn

>
> Terion
>
> On Wed, Jan 28, 2009 at 7:39 PM, Shawn McKenzie <nospam@xxxxxxxxxxxxx
> <mailto:nospam@xxxxxxxxxxxxx>> wrote:
>
>     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
>
>     --
>     PHP General Mailing List (http://www.php.net/)
>     To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux