hunter1611
06-14-2011, 08:47 PM
I know I'm probably going to feel really stupid once someone shows me what I'm doing wrong, but I'm utterly stumped so I'm giving up and asking for help.
I'm running an ordinary query and trying to order the results by one of the columns. Done it a thousand times and never had an issue. But for some reason, the order by in the query just won't work. It connects to the database and pulls down the data just fine, it just won't order it. The data prints out with the default order. I've tried using different columns in the table but nothing ever changes. Below I'll post a copy of the mysql table and my php query code. Let me know if you need to see anything else.
$query4="SELECT * FROM letters ORDER BY year";
$result4=mysql_query($query4);
$num4=mysql_numrows($result4);
$i=0;
while ($i < $num4) {
$l_name1=mysql_result($result4,$i,"file");
$month1=mysql_result($result4,$i,"month");
$year1=mysql_result($result4,$i,"year");
$letter_name = "$month1 $year1";
$letter_ref[$l_name1] = $letter_name;
$i++;
}
http://stokestospain.com/table.gif
http://stokestospain.com/Untitled-4.gif
I'm running an ordinary query and trying to order the results by one of the columns. Done it a thousand times and never had an issue. But for some reason, the order by in the query just won't work. It connects to the database and pulls down the data just fine, it just won't order it. The data prints out with the default order. I've tried using different columns in the table but nothing ever changes. Below I'll post a copy of the mysql table and my php query code. Let me know if you need to see anything else.
$query4="SELECT * FROM letters ORDER BY year";
$result4=mysql_query($query4);
$num4=mysql_numrows($result4);
$i=0;
while ($i < $num4) {
$l_name1=mysql_result($result4,$i,"file");
$month1=mysql_result($result4,$i,"month");
$year1=mysql_result($result4,$i,"year");
$letter_name = "$month1 $year1";
$letter_ref[$l_name1] = $letter_name;
$i++;
}
http://stokestospain.com/table.gif
http://stokestospain.com/Untitled-4.gif