tags:

views:

27

answers:

1

i am trying to make php ajax one to one chat.............my problem is that how can i fetch the chat messages from table by both user1 and user2........ my database table has........

id, from, to, text, time fields..............

what would be the query to show the messages from both users with their respective names....

A: 

The most readable would be, I believe, of the form:

SELECT <fields> FROM <table>
WHERE (from = :me AND to = :him OR from = :him AND to = :me)
  AND <more conditions>
Victor Nicollet
what would be the mysql_fetch_array() because it is giving me the same name user1 and user1 and user1 and so on...........
Web Worm