Posted by Josua Burkard on 10/14/75 11:27
Hello
I have two Tables in MySQL: One with my Users (including Administrators and
normal Users) and one with Support Tickets.
Now i have an SQL-Statement, wich is running in phpMyAdmin without Problems:
SELECT *
FROM (
`HD_tickets`
INNER JOIN HD_users AS HD_users1 ON HD_tickets.tuID = HD_users1.uID
)
INNER JOIN HD_users AS HD_users2 ON HD_tickets.tSupporterID = HD_users2.uID
I Join the user Table for two times with the ticket-table
in php i use this code:
$sql = "SELECT * FROM (`HD_tickets` INNER JOIN HD_users AS HD_users1 ON
HD_tickets.tuID = HD_users1.uID) ";
$sql .= "INNER JOIN HD_users AS HD_users2 ON HD_tickets.tSupporterID =
HD_users2.uID ";
$query = mysql_query($sql);
if (mysql_num_rows($query) != 0)
{
while ($rst = mysql_fetch_array($query))
{
echo $rst['uName']; // From Table HD_users1
echo $rst['uName']; // From Table HD_users2
}
}
Now my Question:
How can i different in the $rst['userName'] from which table this is? From
HD_users1 and HD_users2.
Best regards
Josh
Navigation:
[Reply to this message]
|