new version
This commit is contained in:
parent
f56f2c8338
commit
d39feb1dfc
@ -1,12 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
//
|
||||
// 1. MariaDB Connection Credentials
|
||||
//
|
||||
|
||||
define("DB_HOST", "localhost");
|
||||
// The MariaDB User
|
||||
//
|
||||
// Create with: (1) CREATE USER 'username'@'localhost' IDENTIFIED BY 'your_password';
|
||||
// (2) GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';
|
||||
// (3) FLUSH PRIVILEGES;
|
||||
define("DB_USER", "SQL_DB_USER");
|
||||
define("DB_PASS", "SQL_DB_PASS");
|
||||
define("DB_NAME", "SQL_DB_NAME");
|
||||
|
||||
4
sys.php
4
sys.php
@ -7,14 +7,14 @@
|
||||
*/
|
||||
function sql_read($query) {
|
||||
global $db;
|
||||
if (!isset($db) || is_null($db)) $db = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME,DB_USER,DB_PASS);
|
||||
if (!isset($db) || is_null($db)) $db = new PDO("mysql:host=".DB_HOST.";",DB_USER,DB_PASS);
|
||||
$stmt = $db->prepare($query);
|
||||
if ($stmt->execute() === false) return ["status" => "error", "query"=>$query];
|
||||
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
function sql_write($query) {
|
||||
global $db;
|
||||
if (!isset($db) || is_null($db)) $db = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME,DB_USER,DB_PASS);
|
||||
if (!isset($db) || is_null($db)) $db = new PDO("mysql:host=".DB_HOST.";",DB_USER,DB_PASS);
|
||||
$stmt = $db->prepare($query);
|
||||
if ($stmt->execute() === false) die ("sql error: $query");
|
||||
return $stmt->rowCount();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user