I have a little twitter clone but how to display messages from mysql from newest to oldest.
<?php
session_start();
$connect = mysql_connect ("localhost","root","") or die (mysql_error());
mysql_select_db ("login4") or die (mysql_error());
$_SESSION['username'];
$username1 = $_SESSION['username'];
$username = $_POST['username'];
$submit = $_POST['submit'];
$micro = $_POST['micro'];
$date = date("d-m-Y");
if ($submit){
mysql_query("
INSERT INTO micro VALUES ('','$username','$micro','$date')
");
}
?>
<?php
$query = mysql_query ("SELECT * FROM micro");
while ($row = mysql_fetch_array($query)){
$username = $row['username'];
$micro = $row['micro'];
echo "".$username."<br />".$date."</div><br />".$micro."<br />";
}
?>
<form action="micro.php" method="post">
<input type="text" value="<?php echo $username1 ?>" name="username" readonly="readonly" id="username" />
<br />
<textarea name="micro" id="micro"></textarea>
<br />
<input type="submit" name="submit" value="Blab" />
</form>