I have data stored on a database and I'm showing it on a webpage, at the moment it's ordering it from oldest to newest but I would like the newest to be shown first, I have tried a few things like adding this code that i found on another stack overflow question;
$files[$mod_time] = $basedir.'/'.$filename;
and tried doing a mysql query like this;
$query = mysql_query("SELECT * FROM users LIMIT $start, $per_page ORDER BY ID DESC");
maybe I'm not putting the code in the right place, here is the section of my code that's pulling the data;
if ( $stmt = $mysqli->prepare("SELECT * FROM memo Where uid = ? " ) ) {
$stmt->bind_param("i", $uid2);
$stmt -> execute();
$stmt -> bind_result($id, $note, $uid3);
}
$output=array();
$out_id=array();
$out_note=array();
$i=0;
while ($stmt->fetch()) {
//$out_id[$i]=$id;
//echo $out_id[$i] . " / ";
$out_note[$i]=$note;
echo $out_note[$i]. " <br>";
//echo $i. "<br>";
$i++;
}
$output = array($out_note,$out_id);
rsort($output);
I'm new to PHP, any help or advice would be good for me, thanks a lot.
Aucun commentaire:
Enregistrer un commentaire