Example #1
0
<?php

/* execute selecy
 * 
 */
require __DIR__ . "/class/Query.php";
$str = "";
if (isset($_GET['_id'])) {
    $_id = $_GET['_id'];
    $str = $str . "DELETE FROM Products WHERE _id = {$_id};";
    // echo $str;
}
// run query
Query::run_json($str);
print json_encode(JSON::$response);
Example #2
0
<?php

require './class/Query.php';
$rows = Query::run_json("SELECT name, description FROM Products;");
if ($rows === false) {
    $error = db_error();
    // Handle error - inform administrator, log to file, show error page, etc.
}