Sql sortering HJÆLP
Se link : http://nicolaiklindt.dk/index.php?side=nyhederjeg vil gerne have sådan at den nyeste er øverst.
Mit script:
include_once('inc.config.php');
mysql_connect($cfg['mysql']['host'],$cfg['mysql']['username'],$cfg['mysql']['password']);
mysql_select_db($cfg['mysql']['database']);
$string = str_replace("\r\n","<br>",$string);
$query = mysql_query("SELECT *,dato,id,overskrift,month,day FROM news WHERE sprog = 1 ORDER BY month, day ASC") or die(mysql_error());
while ($row = mysql_fetch_assoc($query)) {
echo ' <font face="Arial" size="2">'.$row['dato'].'<br>';
echo '<i><a href="index.php?side=news.display&id='.$row['id'].'">'.$row['overskrift'].'</a></i><br>';
echo '</font><font color="#800000" size="2" face="Arial"><i>------------------------------------------------------------------------------</i></font><i><font color="#800000" size="2" face="Arial">---------------------------------------</font>';
}
}
else {
include_once('inc.config.php');
mysql_connect($cfg['mysql']['host'],$cfg['mysql']['username'],$cfg['mysql']['password']);
mysql_select_db($cfg['mysql']['database']);
$string = str_replace("\r\n","<br>",$string);
$query = mysql_query("SELECT *,datoeng,id,overskrifteng,month,day FROM news WHERE sprog = 1 ORDER BY month,day DESC") or die(mysql_error());
while ($row = mysql_fetch_assoc($query)) {
echo ' <font face="Arial" size="2">'.$row['datoeng'].'<br>';
echo '<i><a href="index.php?side=news.display&id='.$row['id'].'">'.$row['overskrifteng'].'</a></i><br>';
echo '</font><font color="#800000" size="2" face="Arial"><i>------------------------------------------------------------------------------</i></font><i><font color="#800000" size="2" face="Arial">---------------------------------------</font>';
}
Har prøvet i lang tid kan ikke få det itl at virke.