Esempio n. 1
0
    $updatedOption->LastName = $_POST['lastname'];
    $updatedOption->Gender = $_POST['gender'];
    $updatedOption->Email = $_POST['email'];
    $updatedOption->Address = $_POST['address'];
    $updatedOption->Suburb_Id = $_POST['suburb'];
    $updatedOption->Rating = $_POST['rating'];
    if ($updatedOption->update() == true) {
        header("location:guests.php");
    } else {
        echo "<script>alert('There was an error updating this item');window.location = 'guests.php' </script>";
    }
}
if (isset($_POST['delete'])) {
    $updatedOption = new Guest($db);
    $updatedOption->Id = $_POST['id'];
    if ($updatedOption->delete() == true) {
        header("location:guests.php");
    } else {
        echo "<script>alert('There was an error deleting this item');window.location = 'guests.php' </script>";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
Esempio n. 2
0
    public static function delete_all()
    {
        global $g_pdo;
        $request = <<<EOF
SELECT
  id_guest
FROM
  event_guest
WHERE
  id_event = :id
EOF;
        debug($request);
        $pst = $g_pdo->prepare($request);
        $array = array(":id" => $_SESSION["event_id"]);
        debug("array=" . sprint_r($array));
        $pst->execute($array);
        while (($record = $pst->fetch()) != null) {
            $guest = new Guest();
            $guest->id = $record["id_guest"];
            $guest->delete();
        }
    }