From efd766e16b295bded2f2c552ca2e07324876f99b Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 16 Sep 2018 02:02:51 +0200 Subject: "Fixed" 429 bug :hankey: :bug: --- request.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 request.php (limited to 'request.php') diff --git a/request.php b/request.php new file mode 100644 index 0000000..e649103 --- /dev/null +++ b/request.php @@ -0,0 +1,21 @@ +prepare('SELECT url, title, description, lang FROM url_data WHERE title LIKE :query OR description LIKE :query'); + $checkStmt->execute([':query' => '%' . $query . '%']); + return $checkStmt->fetchAll(PDO::FETCH_ASSOC); +} + +function initDbConnection() +{ + global $servername, $dbname, $username, $password; + $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); + $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $conn->exec('SET CHARACTER SET utf8'); + return $conn; +} \ No newline at end of file -- cgit v1.2.3