$query="select * from messages where client_id='$client_id' ORDER BY `id` DESC";
the script above doesn’t seems to work, i want to select all data equal to the useer input while posting it in descending order
$result = $mysqli->query( $query );
while ($row = $result->fetch_object())
{
$mes_agent_id = $row->poster_id;
$id = $row->msg_id;
$mes = $row->message;
$mes = nl2br($mes);
$cdate = $row->date_post;
$msg ="{$mes} <br> . {$cdate}";
$query_agnt ="select * from agent_info where id='$mes_agent_id'";
$result_agnt = $mysqli->query( $query_agnt );
$row_agnt = $result_agnt->fetch_object();
$mes_agent_first = $row_agnt->first;
$mes_agent_last = $row_agnt->last;
//wall ===================================================
?>
<li class="bar<?php echo $id; ?>">
<div id="news-avatar">
<img src="data/agentpic/<?php echo $mes_agent_first.$mes_agent_last; ?>.jpg" style="height:50px;float:left;margin-right:10px;"/>
</div>
<div align="left" class="post_box">
<br><label><strong><?php echo $mes_agent_first.' '.$mes_agent_last; ?></strong></label> <br> <br>
<?php echo $msg; ?>
<br><br><a href="#" class="comment" id="4">comment</a><br>
</div>
<div id='expand_box'>
<div id='expand_url'></div>
</div>
<div id="fullbox" class="fullbox<?php echo $id; ?>">
<div id="commentload<?php echo $id; ?>" >
how can i post data from database in descending order, while picking where the data should be selected ?
Please change this statement :
$query="select * from messages where client_id='" . $client_id ."' ORDER BYidDESC";