fetch_all(MYSQLI_ASSOC); // GET actions // delete entry if (isset($_GET["del"])) { $sql = "DELETE FROM services WHERE id = ?"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_bind_param($stmt, "s", $param_id); $param_id = $_GET["del"]; if (!mysqli_stmt_execute($stmt) || mysqli_stmt_affected_rows($stmt) != 1) { echo "SQL error."; } else header("location: ".$_SERVER['SCRIPT_NAME']); } // POST actions if ($_SERVER["REQUEST_METHOD"] == "POST") { // add entry if (isset($_POST["add"])) { $sql = "INSERT INTO services (name, type, billing, description) VALUES (?, ?, ?, ?)"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_bind_param($stmt, "ssss", $param_name, $param_type, $param_billing, $param_description); $param_name = $_POST["name"]; $param_type= $_POST["type"]; $param_billing = $_POST["billing"]; $param_description = $_POST["description"]; if (!mysqli_stmt_execute($stmt) || (mysqli_stmt_affected_rows($stmt) != 1)) { echo "SQL error."; } else header("location: ".$_SERVER['SCRIPT_NAME']); } // edit entry if (isset($_POST["save"])) { $sql = "UPDATE services SET name = ?, type = ?, billing = ?, description = ? WHERE id = ?"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_bind_param($stmt, "sssss", $param_name, $param_type, $param_billing, $param_description, $param_id); $param_name = $_POST["name"]; $param_type = $_POST["type"]; $param_billing = $_POST["billing"]; $param_description = $_POST["description"]; $param_id = $_POST["id"]; if (!mysqli_stmt_execute($stmt) || (mysqli_stmt_affected_rows($stmt) != 1)) { echo "SQL error."; } else header("location: ".$_SERVER['SCRIPT_NAME']); } } function getservicebyid($id) { global $services; foreach ($services as $service) { if ($service["id"] == $id) { return $service; } } } ?> ARFNET CSTIMS
ARFNET

ARFNET Client Service Ticket and Invoice Management System

panel

Service offerings

Edit service ".$service["id"]."

\n" ."

\n" ."

\n" ."

\n" ."

\n" ."" ."
cancel" ."
"; } if (isset($_GET["add"])) { echo "

Add service

\n" ."

\n" ."

\n" ."

\n" ."

\n" ."
cancel" ."
"; } ?> add " ."" ."" ."" ."" ."\n"; } ?>
idnametypebillingdescriptionaction
".$service['id']."".$service['name']."".$service['type']."".$service['billing']."
".$service['description']."
del edit

Logged as

Logout

Back to admin panel