-
Notifications
You must be signed in to change notification settings - Fork 0
/
query-test.php
39 lines (22 loc) · 906 Bytes
/
query-test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
require_once __DIR__ . "/vendor/autoload.php";
use hellokant\connection\ConnectionFactory;
try {
$conf = parse_ini_file('src/conf/conf.ini') ;
ConnectionFactory::makeConnection($conf);
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
echo "<h1>tests : sélectionner id, nom, descr, tarif where tarif < 1000</h1>";
$res = \hellokant\query\Query::table("article")
->select(['id', 'nom', 'descr', 'tarif'])
->where('tarif', '<', 1000)
->get();
echo json_encode($res);
echo "<h1>tests : insert</h1>";
$id = \hellokant\query\Query::table('article')->insert(["nom"=>"zoe", "tarif"=>200, "id_categ"=>1]);
echo "<br><br>"."article inséré id : ".$id."<br><br>";
echo "<h1>tests : delete</h1>";
\hellokant\query\Query::table("article")->where("id", "=", $id)->delete();
echo "<br><br>"."article supprimé id : ".$id."<br><br>";