Sorting table acs and desc problem

Data-base pulled out and displayed on page for users to view this is either in ascending or descending order whichever i prefer to be honest.

I have a event datetime, location and an altdate

$sql="INSERT INTO $tbl_name(location, datetime, altdate)VALUES('$location', '$thedate', '$altdate')";

that is what i use on the cp to insert a new event

where the datetime and altdate are 2 seperate fields

format for datetime: DD, dd, M - yy

Shows and inputs correctly

format for altdate: d,m,y’

This is not shown on the users view this is specificly for sorting the table out

So for the table the users views i have

$sql="SELECT * FROM $tbl_name ORDER BY `altdate` ASC";

Now the problem i have is it wont order correctly.

If we take these dates for example
1-5-12
4-5-12
1-6-12

that is how it should be displayed by the user but june for some reason will always slot in under the first where it should be at the bottom because it is the furthest away

My guess is because of the 1 so i am obviously doing something wrong here.

Either in the data-base the insert code is incorect or i dont know

`altdate` varchar(65) NOT NULL default '',

The above is what i used for it when i put it in to the table. For the love of god i cant figure out what i am doing wrong so any ideas would be greatly appriciated.

Thanks

here is an image if i havent made myself clear of how it shows up
www.chulse.co.uk/date-error.png

Sponsor our Newsletter | Privacy Policy | Terms of Service