General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 10th, 2003, 07:41 AM
PHP041 PHP041 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Turkey
Posts: 10 PHP041 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to PHP041
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
Attached Images
File Type: gif myback.gif (33.2 KB, 218 views)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Table relations


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway