I am having a problem figuring out how to sort my results from mysql. I have a table with these values
id, zip_code, month, day, year
I have an array with 10 zip codes and I need to find every record that contains those zip codes. Then based on those results I would like to be able to sort the results based on the date. The code I am using is.
for($t=0; $zipResult = $zip[$t]; $t++) {
$cal_sql = "SELECT * FROM calendar WHERE month >= $month
and day >= $day and year >= $year and zip_code = $zipResult";
$calendar_result = mysql_query($cal_sql);
while($cal_rec = mysql_fetch_array($calendar_result)) {
create_tables($cal_rec['month'],$cal_rec['day'],$cal_rec['year']);
}
}
$month = current month
$day = current day
$zip = zip code array
create_tables() = function that prints the results
I know I am obviously going about it wrong. I just dont know how else to do it.
If you need more info please let me know.
Thanks