Hi Again
Here is the query and code I tried:
$sql = "SELECT * FROM workorders WHERE AdminID = (SELECT AdminID FROM admin
WHERE UserName = '"
. mysql_real_escape_string($_SESSION['user']) . "')";
$result2 = mysql_query ($sql);
$row2 = mysql_fetch_assoc ($result2);
$printrow = print_r($row2);
Here is my print variables--- Nothing printed with the print_r:
$sql"SELECT * FROM workorders WHERE AdminID = (SELECT AdminID FROM admin
WHERE UserName = 'tmiller')"$result2"Resource id #6"$row2""$printrow"1"
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 <[email protected]
> > <mailto:[email protected]>> 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
> >
> >
>