View Full Version : [PHP/MySQL] Ordinare i dati in base ad un timestamp
Devo fare un
SELECT * FROM data ORDER BY updated DESC
Dove updated è un campo di tipo timestamp. Nel modo sopra scritto non funziona, devo applicare qualche particolare funzione mysql al campo updated?
CozzaAmara
24-12-2008, 13:21
Non credo, se il campo timestamp è formattato:
AAAA-MM-GG HH:MM:SS
dovrebbe funzionare senza problemi, strano.
Mi ritorna questo errore:
warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
Codice
$sql = "SELECT *, MATCH(title) AGAINST('$q' IN BOOLEAN MODE)
AS attinenza FROM _data WHERE MATCH(title)
AGAINST('$q' IN BOOLEAN MODE) ORDER BY attinenza DESC, updated DESC LIMIT 100;
";
}
$result = mysql_query($sql);
if(mysql_num_rows($result) == 0){
$output = "<h2>No Result Found!</h2>";
return $output;
}else{
CozzaAmara
24-12-2008, 15:41
Vedo un ";" dopo 100 che non credo ci vada.
malocchio
25-12-2008, 16:57
In questi casi io uso MySQL Query Browser e vedo che errore mi dà (anche se cmq un po' criptico). Va bene anche il client a linea di comando...
risolto. Era un errore sul nome del campo.
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.