[PHP-NOTES] note 130197 added to language.expressions

[email protected] ("[email protected]")
Newsgroups php.notes
Message-ID <[email protected]>
<?php
session_start();

// Datenbankverbindung etablieren
$servername = "mysql";
$username = "root";
$password = "htlkrems";

try {
  // Instanz des PDO Objektes erzeugen
  $conn = new PDO("mysql:host=$servername;dbname=classicmodels", $username, $password);
  // PDO Error Mode auf Exception setzen
  $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  //echo "Connected successfully"; // Ausgabe wenn DB-Verbindung ok
} catch(PDOException $e) {
  // Ausgabe der Fehlermeldung falls DB-Verbindung fehlgeschlagen
  echo "Connection failed: " . $e->getMessage();
}
$displaytext="";

if(isset($_POST['inp'])){
  $_SESSION['inp'] = $_POST['inp'];
}

if(isset($_SESSION['inp'])){
    $inputText = $_SESSION['inp'];
    $stmt = $conn->query("SELECT * FROM offices WHERE city LIKE '$inputText%'");   // SQL Query ausführen
    $displaytext = $inputText;
}
else if(isset($_GET['letter'])){
  $letter = $_GET['letter']; 
  $_SESSION['letter'] = $letter;
  $let = $_SESSION['letter'];
  $stmt = $conn->query("SELECT * FROM offices WHERE city LIKE '$let%'");
}
else{
    $stmt = $conn->query("SELECT * FROM offices");   // SQL Query ausführen
}

$conn->query("SET FOREIGN_KEY_CHECKS = 0");
 
if(isset($_GET['id'])){
    $delCode = $_GET['id'];
    $stmt = $conn->query("DELETE FROM offices WHERE city like '$delCode'");
}
if(isset($_GET['subDel']))
if (isset($_GET['del']) && is_array($_GET['del'])){
        $delID = $_GET['del'];
        foreach($delID as $del){
            $stmt = $conn->query("DELETE FROM offices WHERE city like '$del'");
        }
    }
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 193.170.70.27)
----
Manual Page -- https://php.net/manual/en/language.expressions.php
Edit        -- https://main.php.net/note/edit/130197
Del: integrated  -- https://main.php.net/note/delete/130197/integrated
Del: useless     -- https://main.php.net/note/delete/130197/useless
Del: bad code    -- https://main.php.net/note/delete/130197/bad+code
Del: spam        -- https://main.php.net/note/delete/130197/spam
Del: non-english -- https://main.php.net/note/delete/130197/non-english
Del: in docs     -- https://main.php.net/note/delete/130197/in+docs
Del: other reasons-- https://main.php.net/note/delete/130197
Reject      -- https://main.php.net/note/reject/130197
Search      -- https://main.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.