我正在尝试让php ajax一对一聊天.............我的问题是我如何才能从user1和user2获取表中的聊天消息..... ... 我的数据库表有........
id,from,to,text,time fields ..............
用两个用户显示来自各自名称的消息的查询是什么....
答案 0 :(得分:0)
我相信,最可读的形式是:
SELECT <fields> FROM <table>
WHERE (from = :me AND to = :him OR from = :him AND to = :me)
AND <more conditions>