Posts

Showing posts with the label while-loop

Calling function from while loop causing infinite loop

Calling function from while loop causing infinite loop I have a MySQLi statement in a function as follows: function getTimeData($time) { $con = mysqli_connect("domain:port", "user", "password", "dbname") or die (mysql_error()); $selectedDate = $_SESSION['date']; $prepTimeData = mysqli_prepare($con, "SELECT * FROM `time` WHERE `date`=? AND `time`<=? AND `endTime`>=?"); $prepTimeData->bind_param("sss", $selectedDate, $time, $time); $prepTimeData->execute(); $getTimeData = $prepTimeData->get_result(); return $getTimeData; } and then a while loop to iterate over all the results: while ($data0800 = getTimeData("0800")->fetch_assoc()) { ?><tr><td><?php $data0800['first_name'];?></td> <td><?php $data0800['riderage'];?></td> <td><?php $data0800['ridinglevel'];?></td> <td><?ph...