我从我的数据库中获取时间,当我回显它时它可以工作,但它在 while 循环中不起作用。但是,其他变量起作用...
代码:
$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
}