-
Notifications
You must be signed in to change notification settings - Fork 0
Query delete Method
Samuel Fajreldines edited this page Mar 1, 2018
·
1 revision
public function delete($safemode = true, $result_comparison_signal = '>'){This method is responsible for executes a new DELETE FROM query.
- $safemode - If true it will not execute the query if there aren't where conditions.
- $result_comparison_signal - Comparison signal to verify if query was successfully executed. - See More
<?php
require_once('class_db.php');
$sql = new query(array(
'host' => 'localhost' ,
'user' => 'root' ,
'password' => '' ,
'database' => 'test' ,
'db_type' => 'mysqli' ,
));
$sql->table('users');
$sql->where('name','Samuel Fajreldines');
$query = $sql->delete();
var_dump('Query result: ' . var_export($query->result,true));
var_dump($query);Returns
string(18) "Query result: true"
object(stdClass)#3 (8) {
["sql"]=>
string(51) "DELETE FROM users WHERE name = 'Samuel Fajreldines'"
["fetch"]=>
array(0) {
}
["result"]=>
bool(true)
["object"]=>
bool(true)
["num_rows"]=>
int(0)
["have_rows"]=>
bool(false)
["affected_rows"]=>
int(2)
["elapsed_time"]=>
int(0)
}