0

I'm writing chat system like facebook or whatsapp. e.g
http://masters.az/message
login:test
pass:test I wrote inside of message.But outside(inbox) is problem.If you enter this site you can see what I want.I need the last message of each chat and order by time.

mysql form is

id|mail|by|to|time|read

my current mysql_query is:

$usid=my user id

$q=mysql_query("
select * from (select * from `mail` ORDER BY id DESC) AS x
where (`to`='$usid' || `by`='$usid')
group by (`by`) desc order by vaxt desc
");
Marc B
  • 356,200
  • 43
  • 426
  • 500
Fuad Pashayev
  • 75
  • 1
  • 8
  • Please [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). [These extensions](http://php.net/manual/en/migration70.removed-exts-sapis.php) have been removed in PHP 7. Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) statements for [PDO](http://php.net/manual/en/pdo.prepared-statements.php) and [MySQLi](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) and consider using PDO, [it's really pretty easy](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Feb 01 '16 at 20:50
  • I know that's why I use class leo::mq=>mysql_query and I can change it to Pdo system any time I want,now I need this – Fuad Pashayev Feb 01 '16 at 20:52

0 Answers0