Permalink
Browse files

Insert new bug

  • Loading branch information...
samcroft committed Sep 28, 2012
1 parent 7da65a4 commit aa57a2ae75e9dcea2ada97453e93c2ee1f1dde64
Showing with 25 additions and 0 deletions.
  1. +25 −0 server/add-bug.php
View
@@ -0,0 +1,25 @@
<?php
$server = "localhost";
$username = "root";
$password = "";
$database = "bapp";
$con = mysql_connect($server, $username, $password) or die ("Could not connect: " . mysql_error());
mysql_select_db($database, $con);
$bugTitle = mysql_real_escape_string($_POST["bug-title"]);
$bugDetails = mysql_real_escape_string($_POST["bug-details"]);
$bugPriority = mysql_real_escape_string($_POST["bug-priority"]);
$sql = "INSERT INTO bugs (title, details, priority) ";
$sql .= "VALUES ('$bugTitle', '$bugDetails', $bugPriority)";
if (!mysql_query($sql, $con)) {
die('Error: ' . mysql_error());
} else {
echo "Bug added";
}
mysql_close($con);
?>

0 comments on commit aa57a2a

Please sign in to comment.