Hy everyone,
I have a form where a user types all the news from where I work and in a php page a made a select to display all the news typed by this user, but they have to be in order from the newest one to the oldest one.
This is my select, but is not showing me all the records, only the newest one:
require('connect.php');
$con=mysql_connect("$host", "$username", "$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("$db_name", $con);
mysql_select_db("$db_name")or die("cannot select DB");
$sql= "select * from mytable";
$result=mysql_query($sql) or die(mysql_error());
while ($row_news = mysql_fetch_assoc($result))
{
$id = $row_news ["id"];
$title = $row_news ["title"];
$author = $row_news ["author"];
$gmt_date = $row_news ["date"];
$dateoffsetworking = mysql_query("select \"$gmt_date\" $timeoffsetplusminus interval $timeoffset hour");
$dateoffset = mysql_result($dateoffsetworking,0);
$date2 = mysql_query("select DATE_FORMAT('$dateoffset', '$dateformat')");
$date2_results = mysql_result($date2,0);
$post = $row_news ["post"];
}
?>
Here I inserted a table to display each record:
<table width="80%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td><p><b><?Php echo "$title"; ?></b></p></td>
</tr>
<tr>
<td><p><i>Posted by <? echo "$author"; ?> on <? echo "$gmt_date"; ?></i><br>
</p></td>
</tr>
<tr>
<td><? echo "$post"; ?></td>
</tr>
</table>