Skip to content

Instantly share code, notes, and snippets.

@pol
Created October 16, 2008 20:53
Show Gist options
  • Save pol/17258 to your computer and use it in GitHub Desktop.
Save pol/17258 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
# Connect to the db
$connection = mysql_connect("localhost","root","");
mysql_select_db("bithlo2", $connection);
print_r($_POST);
if(isset($_POST['clear'])){
$query="UPDATE bithlosurvey SET score1=0, score2=0, score3=0, score4=0, score5=0 WHERE 1";
$result = mysql_query($query, $connection);
$cleared = true;
}
if($cleared){
?>
<center>Ok, its all gone now. Gone. All of it. Really gone. The database has been fully cleared. What? You call me a liar? Fine. Here, look for yourself:</center>
<center>
<?php
$myquery= "SELECT * FROM bithlosurvey2";
$result = mysql_query ($myquery, $connection);
print "<table border=1 cellpadding=2>";
print "<tr><th>Course</th><th>Question</th><th>Great</th><th>Good</th><th>Ok</th><th>So-So</th><th>SUCKS LEMONS</th></tr>";
while ($row = mysql_fetch_array($result))
{
print "<tr>";
print "<td>".$course_names[$row['Course']]."</td>";
print "<td>".$row['Question']."</td>";
print "<td align=center>".$row['score1']."</td>";
print "<td align=center>".$row['score2']."</td>";
print "<td align=center>".$row['score3']."</td>";
print "<td align=center>".$row['score4']."</td>";
print "<td align=center>".$row['score5']."</td>";
print "</tr> \n";
}
print "</table>";
?>
</center>
<center>See? I told you so. So, your work here is pretty much done, unless you want to go back and replace the data in the database after you kicked the last of it out. </center>
<center><form action="surveycapture_bithlo.html" method="POST">
<input type="submit" value="I feel sorry for the data, so I will add more to the database" />
</form>
<?php }else{ ?>
<center>Do you really want to clear the database? Once you click that button there, all of the data will really be really, really gone. So make sure thats what you really want to do. Really.</center>
<center>
<form action="surveyzero.php" method="POST">
<input type="submit" name="clear" value="Clear the Database"/>
</form>
<form action="surveycapture_bithlo.html" method="POST">
<input type="submit" value="No, I really want to add MORE data to the database" />
</form>
</center>
<? } ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment