thank you cyberRobot for your help and reply .
i tryed to use from here
http://php.net/manual/en/array.sorting.php
but i did not succes .
but here all the code that i have for the comments :
1-
the script :
<script>
$(".quick_comment").click(function() {
$(this).next().next().css("display","block");
$(this).next().next().find(".commentmessage").focus();
return false;
});
$(".commentsubmit").click(function() {
if ($(this).prev()[0].value != "") {
var thiscomment = $(this).parents(".quick_comment_form");
var cbox = thiscomment.next().next();
var mbox = thiscomment.find(".commentmessage");
var tbox = thiscomment.next();
cbox.html("<img src=\"'.uhome().'/files/loading.gif\" /> Submitting");
$.post("'.uhome().'/index.php?p=jquery/comment_publish",
{message:mbox[0].value,target_id:tbox[0].value},
function(data){
cbox.html("");
$(".quick_comment_form").css("display","none");
cbox.after(data);
mbox.attr("value","");
},"html"
);
return false;
}
});
</script>
2-
the jquery code : ( function comment_publish )
$arr = array(
'avatar'=>$client['avatar'],'message'=>stripslashes($_POST['message']),'username'=>$client['uname'],'created'=>time()
);
echo comment_display($arr);
3-
function comment_display
function comment_display($row = array()) {
if (!$row['avatar']) {
$res = sql_query("select avatar from ".tb()."accounts where id='{$row['uid']}'");
$row2 = sql_fetch_array($res);
if (!$row2['avatar'])
$row['avatar'] = 'undefined.jpg';
else
$row['avatar'] = $row2['avatar'];
};
return '
<div class="user_comment">
<table width="100%">
<tr>
<td class="user_post_left" width="40" valign="top">'.avatar($row,25).'</td>
<td class="user_post_right" valign="top">
<strong>'.url('u/'.$row['username'], $row['username']).'</strong>
'.h($row['message']).'
<div class="att_bottom">'.get_date($row['created']).'</div></td>
</tr>
</table>
</div>
';
}
thank you verry much