php


Chat Server Query


I am building a chat server on PHP. More like facebook one to one chat. I can't figure out the query which displays the messages of the two users who are chatting. Right now i am only able to view receiver's messages and not the sender's messages.
public function getMessages($rid,$userid) {
$messages = array();
$query = <<<QUERY
SELECT
`chat`.`message`,
`chat`.`sent_on`,
`chat`.`rec_id`,
`user1`.`id`,
`user1`.`first_name`
FROM `user1`
JOIN `chat`
ON `chat`.`user_id` = `user1`.`id` WHERE `user1`.`id`=$rid
ORDER BY `sent_on`
QUERY;

Related Links

CodeIgniter: parenthesis being replaced by character codes
how to avoid typing letters in html? [duplicate]
Pass Jquery variable to PHP variable in same page
How can my users answer to one email and that goes to user account on website?
getting error on php database query
Regular expression to extract target url from a htaccess rewrite rule string in php?
What should be first: setting or cache object
How to detect the last insert ID within a transaction in Yii using DAO?
PHP function with parameter set by link
php - Dynamic array element value using regular expression result
Why is Facebook api Privacy parameters- custom - allow ignoring friend id's?
BlowfishPasswordHasher doesnt allow login
Using ftp_fget using SFTP / phpseclib
Node JS to PHP, cannot get it working
Get raw data from pastebin
Send PHP query result via JSON

Categories

HOME
macos-sierra
systemd
openlayers-3
iverilog
openflow
impala
clone
ui-automation
timber
mutation-testing
solution
nsstring
google-awareness
temperature
c#-7.0
exe
fosuserbundle
string-formatting
cmake-gui
neo4j.rb
stackexchange.redis
substring
function-points
managed-c++
webviewclient
marquee
jackrabbit-oak
tsung
ibm-connections
audit
source-insight
netbios
plantuml
counting
landscape
ms-dos
strapi
reset
best-buy-api
netapp
slideshow
fiware-wirecloud
web-inspector
vesta
docker-ucp
viewmodel
tinyioc
android-mediarecorder
portability
polymaps
kendo-treeview
adobe-reader
finder
svnserve
nvda
traversable
apple-configurator
psd
teensy
bayesglm
extend
netdatacontractserializer
jnlp
relational-model
actionpack
deque
python-curses
mxe
maven-shade-plugin
nhibernate-criteria
uno
rubber
adwords-apiv201402
visual-studio-6
loginview
angular-ui-select
redpitaya
thruway
lync-2010
iosched
discovery
stty
hints
acceptance-testing
chartfx
notin
prototypal-inheritance
exponent
delphi-prism
space-partitioning
winsxs
downgrade
mygeneration
resharper-5.1
browser-based
firephp
motif
suggestbox
server-load
chronic
account-management

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App