diff --git a/ajax.php b/ajax.php index 943eb5a..3409b1a 100644 --- a/ajax.php +++ b/ajax.php @@ -33,12 +33,12 @@ switch($_GET["action"]) { } break; case "add_found": - if (hasval($_POST["was"]) && hasval($_POST["wann"]) && hasval($_POST["wo"])) { + if (hasval($_POST["was"]) && hasval($_POST["wann"]) && hasval($_POST["wo"])&& hasval($_POST["container"])) { /* Prepared statement, stage 1: prepare */ - if (!($stmt = $mysqli->prepare("INSERT INTO found_items(was, wann, wo) VALUES (?, ?, ?)"))) { + if (!($stmt = $mysqli->prepare("INSERT INTO found_items(was, wann, wo, container) VALUES (?, ?, ?, ?)"))) { $errormsg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; } - if (!$stmt->bind_param("sss", $_POST["was"], $_POST["wann"], $_POST["wo"])) { + if (!$stmt->bind_param("ssss", $_POST["was"], $_POST["wann"], $_POST["wo"], $_POST["container"])) { $errormsg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; } if (!$stmt->execute()) { @@ -103,13 +103,13 @@ switch($_GET["action"]) { } break; case "edit_found_item": - if(hasval($_POST["id"]) && hasval($_POST["was"])) { + if(hasval($_POST["id"]) && hasval($_POST["was"])&& hasval($_POST["container"])) { /* Prepared statement, stage 1: prepare */ $was=$_POST["was"]; - if (!($stmt = $mysqli->prepare("UPDATE found_items SET was=?, wo=?, wann=? WHERE id = ?"))) { + if (!($stmt = $mysqli->prepare("UPDATE found_items SET was=?, wo=?, wann=?, container=? WHERE id = ?"))) { $errormsg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; } - if (!$stmt->bind_param("sssi", $_POST["was"] , $_POST["wo"], $_POST["wann"], $_POST["id"])) { + if (!$stmt->bind_param("ssssi", $_POST["was"] , $_POST["wo"], $_POST["wann"], $_POST["container"], $_POST["id"])) { $errormsg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; } if (!$stmt->execute()) { @@ -148,12 +148,12 @@ switch($_GET["action"]) { } break; case "add_found_item": - if (hasval($_POST["was"])) { + if (hasval($_POST["was"])&& hasval($_POST["container"])) { /* Prepared statement, stage 1: prepare */ - if (!($stmt = $mysqli->prepare("INSERT INTO found_items(was) VALUES (?)"))) { + if (!($stmt = $mysqli->prepare("INSERT INTO found_items(was, container) VALUES (?, ?)"))) { $errormsg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; } - if (!$stmt->bind_param("s", $_POST["was"])) { + if (!$stmt->bind_param("ss", $_POST["was"], $_POST["container"])) { $errormsg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; } if (!$stmt->execute()) { @@ -196,6 +196,7 @@ switch($_GET["action"]) {