getMessage(), "\n
"; } //Primary SQL Statement $statement = $pdo->prepare("SELECT zf_bap_orders.*,zbs.name as zbs_name FROM zf_bap_orders JOIN zf_bap_schemes zbs on zf_bap_orders.scheme_id = zbs.scheme_id WHERE code = :code AND status_id = :status_id"); //Bind parameters $statement->bindParam("code", $_GET["code"]); // "Auth" 2 $expected_status = 2; // 2 equals "is paid" $statement->bindParam(":status_id", $expected_status); //Only show, if ticket is paid //Execute Statement and fetch Data $statement->execute(); $row2 = $statement->fetch(); if(!($row2["order_id"]>0)){ die('Fehler! Ticket ist ungültig.'); } //Get Payment methode using ternary operator $zahlung = $row2["paypal_token"] != "" ? "Paypal" : "Barzahlung"; //Looks like shit, but works :D (PHP Serialized Class -> JSON -> PHP stdClass -> PHP Object) $seats = json_decode(json_encode(unserialize($row2["places"])), true); //Convert object to HTML List $seat_html = ""; foreach ($seats as $seat) { $seat_html .= $seat["place_name"] . " (" . $seat["place_price"] . "€), "; // results in e.g. 'Reihe 1, Platz 2 (5€)' } echo ' Zauberflöte - Ticketbuchung

Ticket: '.$row2["order_id"] . "_" . $row2["code"].'

Name ' . $row2["first_name"] . " " . $row2["last_name"] . '
Bestelldatum ' . $row2["date"] . '
Vorstellung ' . $row2["zbs_name"] . '
Platz ' . $seat_html . '
Zahlung ' . $zahlung . '
';