947740 Posted June 22, 2009 Share Posted June 22, 2009 This code is giving me a t_while. I guess it just needs some fresh eyes. <?php session_start(); if($_SESSION['loggedin'] != 1 || $_SESSION['auth'] < 1) { header("Location: ../admin/login.php"); } if(!isset($_POST['afterschool'])) { header("Location: query.php"); } $sdate = strtotime($_POST['sdate']); $edate = strtotime($_POST['edate']); $query = "SELECT * from afterschool where Time > $sdate AND Time < $edate"; $result = mysqli_query($cxn,$result) or $error = "Query failed: ".mysqli_error($cxn); $costs = array("1" => "5", "2" => "4", "3" => "3", "4" => "2", "5" => "1") while($row = mysqli_fetch_assoc($result)) { $time = ($row['CheckOut'] - $row['CheckIn']) / 60 / 60; $n = $row['NumberStudents']; $n = $costs[$n]; $string = strtolower($row['ParentName']); $partial_money[$string] += ($time * $n); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/163269-t_while/ Share on other sites More sharing options...
Maq Posted June 22, 2009 Share Posted June 22, 2009 ';' after your $costs array. Quote Link to comment https://forums.phpfreaks.com/topic/163269-t_while/#findComment-861394 Share on other sites More sharing options...
947740 Posted June 22, 2009 Author Share Posted June 22, 2009 Ah...thank you. Quote Link to comment https://forums.phpfreaks.com/topic/163269-t_while/#findComment-861398 Share on other sites More sharing options...
Maq Posted June 22, 2009 Share Posted June 22, 2009 Ah...thank you. Next time post the FULL error and the line number. Quote Link to comment https://forums.phpfreaks.com/topic/163269-t_while/#findComment-861405 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.