Avevo questa stringa:
Codice PHP:
$sql = 'SELECT a.aid, a.title, a.description, category, visibility, filepath, ' . 'filename, url_prefix, pwidth, pheight ' . 'FROM ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'LEFT JOIN ' . $CONFIG['TABLE_PICTURES'] . ' as p ' . 'ON a.thumb=p.pid ' . 'WHERE category=' . $cat . $album_filter . ' ORDER BY a.pos ' . $limit;
Ho sostituito
Codice PHP:
' ORDER BY a.pos '
con
Codice PHP:
' ORDER BY a.title '
e in questo modo gli elementi in questione vengono ordinati alfabeticamente.
Però il corretto ordine per i caratteri alfanumerici fa in modo che, per esempio, avendo questi nomi:
10, 11, 12, 100
l'ordine sia
10, 100, 11, 12.
Volevo sapere se ci fosse un modo per far ordinare alfabeticamente nel modo 10,11,12,100 e non quello attuale che mette il 100 davanti all'11...
Mi hanno detto di provare a sostituire
Codice PHP:
' ORDER BY a.title '
con questo:
Codice PHP:
' ORDER BY CAST(a.title AS INTEGER) '
Ma ottengo questo errore:
mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTEGER) LIMIT 24,11' at line 1
La mia versione di mysql se può essere utile, è 4.1.20.
Spero che possiate aiutarmi, grazie.