- This is a PDO class written in PHP that you use to handle connections to databases like MySQL, SQLite etc.
$sql = new PDOWrapper('localhost', 'root', 'mypassword', 'test_database');
-
Using to delete queries:
- $sql->query("DELETE FROM users WHERE id = 1")
-
Obviously you can use another methods, they all will work fine.
-
Selecting a ID from a table:
- $sql->fetch_array("SELECT id FROM users WHERE user = 'admin'");
-
Showing all values from a table:
- $sql->fetch_array("SELECT id FROM users");
$sql->insert('users', ['id' => 10, 'name' => 'Paulo', 'age' => '18'])
$sql->update('test', ['age' => '18', 'name' => 'Paulo'], ['id' => 10])
- First array are the values to be updated.
- Second array is/are the parameter used in WHERE. (it can be added more)
$sql->search('users', ['name', 'Paulo'])
- First field in the array is the column name.
- Second field in the array is the value.
$sql->rowCount("users")
$sql->tablesCount()
$sql->lastInsertId()