Example #1
0
 /**
  * Updates tables customers and payments for given $_GET['user_selected']
  * @return array $customerUpdate with new list of customers
  */
 public static function UpdateUsers()
 {
     $conn = DB::GetConnection();
     $user_selected = $_GET['user_selected'];
     $select_status = (int) $_POST['select_status'];
     $stmt = $conn->prepare("UPDATE customers SET customers.customer_name = ?,customers.customer_lastname = ?,customers.customer_phone = ? WHERE customers.customer_id = ?");
     $stmt->bindParam(1, $_POST['upd_firstname'], \PDO::PARAM_STR);
     $stmt->bindParam(2, $_POST['upd_lastname'], \PDO::PARAM_STR);
     $stmt->bindParam(3, $_POST['upd_phone'], \PDO::PARAM_STR);
     $stmt->bindParam(4, $user_selected, \PDO::PARAM_INT);
     $stmt->execute();
     $stmt = $conn->prepare("UPDATE payments SET payments.payment_status_id = ? WHERE payments.payment_customer = ?");
     $stmt->bindParam(1, $select_status);
     $stmt->bindParam(2, $user_selected);
     $stmt->execute();
     return $customerUpdate = Admin::ViewUsers(true);
 }
Example #2
0
    Session::DestroySession();
}
if (isset($_POST['confirm'])) {
    $customerUpdate = AdminClass::UpdateUsers();
    header("Location: Admin.php");
} else {
    if (isset($_POST['cancel'])) {
        header("Location: Admin.php");
    } else {
        if (isset($_GET['delete'])) {
            AdminClass::DeleteUsers();
            header("Location: Admin.php");
        }
    }
}
$customers = AdminClass::ViewUsers();
?>

	<form action='' method='get' id='admin_form'></form>		
	<table class='datatable'>
		<caption> 
				Users List: 
		</caption>
		<tr>
			<th scope='col'>Select User: </th>
			<th scope='col'>Firstname: </th>
			<th scope='col'>Lastname: </th>
			<th scope='col'>Phone: </th>
			<th scope='col'>Check in: </th>
			<th scope='col'>Check out: </th>
			<th scope='col'>Room: </th>