Tracking Your Day

was it HellFire, average, or GreenAsGrass


">
Back to aka.net
Chart the Data
connect_error) {die("Connection failed: " . $conn->connect_error);} // fail if most recent entry was today $dupcheck = "select id, date(date), how_rough from $table where date(date) = curdate() order by id desc limit 1"; //the select criteria $dupresult = $conn->query($dupcheck); //tell the connection to run the select criteria $dupgot = $dupresult->fetch_assoc(); //return array of row values into $dupgot from the connection or a FALSE if date<>curdate if ($dupresult->num_rows > 0) {echo "
Too many clicks today.
The most recent entry was ID " . $dupgot["id"] . " on " . $dupgot["date(date)"] . " with a value of " . $dupgot["how_rough"] . "
"; $conn->close();} else{ // insert into table $sql = "INSERT INTO $table (date, how_rough) VALUES ('$date', '$how_rough')"; if ($conn->query($sql) === TRUE) {echo "New record created successfully.";} else {echo "Error: " . $sql . "
" . $conn->error;} $conn->close(); } // closes the else insert into table } // closes the if $_SERVER checker above function test_input($data) { //remove bad characters from how_rough and return it to $how_rough $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?>