Order Note
In php programming, we may notice that if we sort a group of datas by a string field storing numbers , maybe we can not get the correct order we want .For example:
image1.jpg,image2.jpg,image10.jpg,image20.jpg,
after using function sort(),得到:
image1.jpg,image10.jpg,image2.jpg,image20.jpg,
this may be not what we want, so we can use natsort() to fix it .
But in the database if the field is varchar or text,how should we fix it ?
We can use this function :CAST.For example
select * from image order by CAST(`image_order` AS SIGNED INT)
just to convert string to int, that is all. Anyway , if noticing it before , we can change the type of image_order with SIGNED INT, that is better.