javascript - Fetch records from table -
i working on chat app. stored msg db, not fetch , show admin msg send in reply person after person 1 send msg admin.
$email = $_get["q"]; if($email== "admin@gmail.com") { $sql = "select *, date_format(chatdate,'%d-%m-%y %r') cdt chat order username , id"; $sql = "select * (" . $sql . ") ch order id"; $result = mysql_query($sql) or die('query failed: ' . mysql_error()); // update row information $msg="<table border='0' style='font-size: 10pt; color: blue; font-family: verdana, arial;'>"; while ($line = mysql_fetch_array($result, mysql_assoc)) { $msg = $msg . "<tr><td>" . $line["cdt"] . " </td>" . "<td>" . $line["username"] . ": </td>" . "<td>" . $line["msg"] . "</td></tr>"; } $msg=$msg . "</table>"; echo $msg;
you can apply multiple order by
in filed using comma
so instead of
order username , id
use
order username,id
also stop using mysql deprecated. can use mysqli or pdo
Comments
Post a Comment