I am getting time from my database, when I echo it out it works, but it doesn't work in the while loop. However, the other variables work...
Code:
$resultevent = mysql_query('SELECT venue, date, TIME_FORMAT(startTime, "%h:%i %p") AS startTime2, TIME_FORMAT(endTime, "%h:%i %p") AS endTime2 FROM events"');
$rowevent = mysql_fetch_assoc($resultevent);
$date = new DateTime($originaldate);
$newdate = $date->format('m/d/Y');
$startTime2 = $rowevent['startTime'];
$endTime2 = $rowevent['endTime'];
$venue = $rowevent['venue'];
echo $startTime2; <============== WORKS HERE
while ($row = mysql_fetch_assoc($result)) { //the code for these queries is not shown
echo 'getting here'; <======= WORKS
echo $venue; <======= WORKS
echo $startTime2; <======= DOESNT WORK
}
$result
for starters? – Breezer Oct 8 at 2:34echo
statements to look more like this:"At line 10, we echo $startTime2 as " . $startTime2;
- this makes it unambiguous which lines are doing what. – Floris Oct 8 at 2:35