-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddmove.php
22 lines (21 loc) · 861 Bytes
/
addmove.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
//Turn on error reporting
ini_set('display_errors', 'On');
//Connects to the database
$mysqli = new mysqli("oniddb.cws.oregonstate.edu", "beatoj-db", "dHdMIX4gvy4VC2dw", "beatoj-db");
if($mysqli->connect_errno) {
echo "Connection error " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
//echo "THIS WORKS";
if(!($stmt = $mysqli->prepare("INSERT INTO Move(move_name, description, strength) VALUES (?,?,?)"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->bind_param("ssi",$_POST['MoveName'],$_POST['MoveDescription'],$_POST['MoveStrength']))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
if(!$stmt->execute()){
echo "Execute failed: " . $stmt->errno . " " . $stmt->error;
} else {
echo "Added " . $stmt->affected_rows . " rows to Move.";
}
?>