
October 10th, 2003, 07:41 AM
|
|
Junior Member
|
|
Join Date: Oct 2003
Location: Turkey
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Table relations
I have two tables which one of them is users and second is reports. I have userID inserted into reports table to personel1, personel2,personel3,personel4,personel5.
I am trying to relate these two tables by sql code as follows;
$query3 =mysql_query("SELECT reports.personel1,reports.personel2,reports.person el3, reports.personel4,reports.personel5,users.userID,u sers.userLoginfrom reports,users WHERE $personel1 = users.userID or users.userID = $personel2 or users.userID = $personel3
or users.userID = $personel4 or users.userID = $personel5 AND reports.eventID = '$eventID' ");
while ($result3 = mysql_fetch_array($query3))
{
echo "<td>";
echo $result3["userLogin"] . "</td>";
}
ýt seems OK but here what happens. When I enter a new report with the same $eventID, I see the same personel names twice on the screen. When I run the script with AND instead of OR I see nothing on the screen. Should I do something different , any suggestions?
Best Regards
|