connect_error) {die("Connection failed: " . $conn->connect_error);}
// get mysql data and enter it into table
$requested = "select id, date(date), how_rough from $table order by id"; //the select criteria
$dataresult = $conn->query($requested); //tell the connection to run the select criteria
//$data = $dataresult->fetch_assoc(); //return array of row values into $data from the connection
if ($dataresult->num_rows > 0)
{
// output data of each row into table on left
while($row = $dataresult->fetch_assoc()) {
echo '
';
echo '
'. $row['id'] .'
';
echo '
'. $row['date(date)'] .'
';
echo '
'. $row['how_rough'] .'
';
echo '
';}
}
else {echo "0 results";}
?>
query($harsh);
if ($harshresult->num_rows > 0){
while($bad = $harshresult->fetch_assoc()) {echo '
For How Rough value = '.$bad['how_rough']. '
'. $bad['count(*)']. ' days.
';$sum=$sum+$bad['count(*)'];}
echo '
total entries to date
'. $sum. '
';
} //end of if
$cnt = "select how_rough, count(*) from $table group by how_rough"; //sets javascript variables to populate canvas chart
$cntresult = $conn->query($cnt);
while($rows = $cntresult->fetch_assoc()){
echo ''; // set barht = count of how rough for each bar
}
$conn->close();
?>