Terion Miller wrote:
> 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"
>
O.K., easy:

1. There is no UserName in admin that = $_SESSION['user']
2. Or, the AdminID that is returned for $_SESSION['user'] is not present
in workorders

That's why I suggested the 2 query approach the first time so that you
could echo out the AdminID after the first query and then go into the db
and make sure it exists in workorders.  Or, if none were returned, then
echo out $_SESSION['user'] and make sure it exists in admin.

-Shawn

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

Reply via email to