Jump to content

T_WHILE


947740

Recommended Posts

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);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/163269-t_while/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.