I'm having a problem with the following code:
<?php
$qGetWorkoutDate = "SELECT workoutdate FROM tblworkouts WHERE workoutdate between curdate() and date_add(curdate(),interval 7 day) limit 1";
$rGetWorkoutDate = mysql_query($qGetWorkoutDate) or die ("Error in query: $qGetWorkoutDate. " . mysql_error());
if (mysql_num_rows($rGetWorkoutDate)>0)
{
while ($WorkoutDate_row = mysql_fetch_array ($rGetWorkoutDate));
{
$workoutdate = $WorkoutDate_row['workoutdate'];
?>
<html>
<head></head>
<title></title>
<body>
<table width="800px" cellpadding="0" cellspacing="0">
<tr>
<td width="800px" style="background-color: white; font-family: arial; color: black; font-weight: bold; height: 25px;padding-left: 5px;">
This Week's Workout: <?php echo formatDate($workoutdate);?>
</td>
</tr>
<?php
}
}
?>
I know that the SQL query is valid because I have run it in MySQL Studio without any problems. Also, I know the formDate function works because I substituted $workoutdate with the value '2003-03-26 19:00:00' with success.
The only errors I receive relate to the function and as I have said this is because the variable $workoutdate is empty.
Any suggestions?