Ok, I renamed a few of the vars to avoid confusion or misinterpretation... all the vars are now preceded with schedule_ . The code I have is as follows:
<?php
//set up a formula to determine opponents for next game.
$shortdate = date("Y-m-d"); //for database compare to get opponent
$sql="SELECT *
FROM schedule
WHERE UNIX_TIMESTAMP(schedule_date) >= UNIX_TIMESTAMP($shortdate)
ORDER BY schedule_date, schedule_time ASC
LIMIT 0,1";
$result=mysql_query($sql);
if (isset($result)) {
$row = mysql_fetch_assoc($result);
}else {
print ('There are no upcoming games listed');
}
print_r($row);
//end formula
?>
The result I get from a print_r is:
Array ( [schedule_id] => 1 [schedule_week] => 1 [schedule_date] => 2006-04-27 [schedule_day] => Thursday [schedule_time] => 06:15:00 [schedule_diamond] => 6 [schedule_vs] => RE\MAX [schedule_result] => Win )
when the result should be:
Array ( [schedule_id] => 14 [schedule_week] => 14 [schedule_date] => 2006-08-03 [schedule_day] => Sunday [schedule_time] => 06:15:00 [schedule_diamond] => 0 [schedule_vs] => Casto [schedule_result] => )
Now I have the data type in MYSQL set as (DATE) for schedule_date. It looks like this 2006-08-03. In php, the $shortdatedate(Y,m,d) looks like this 2006-07-23. Now I have both of those #'s in the same format and even tried UNIX_TIMESTAMP() to both and it still will not allow them to compare. If i change the sql to WHERE week >= 13 it works fine with pulling the right data. So, I hope to get this figured out as I understand the concept but cant get the numbers to come out right. Should I be using the mysql_fetch_assoc? Also, why does it keep defaulting or displaying the first entry in the db? That doesnt fit the WHERE clause. Thanks again ! I really appreciate it!