Basic implementation event signup
This commit is contained in:
@ -17,11 +17,21 @@ class DatabaseHandler {
|
||||
return $this->getResults($sql);
|
||||
}
|
||||
|
||||
public function insertRows(string $tableName, array $newData) : int
|
||||
public function deleteFromDb(string $table, array $conditions = []) {
|
||||
global $wpdb;
|
||||
$table = $wpdb->prefix . $table;
|
||||
$wpdb->delete($table, $conditions);
|
||||
}
|
||||
|
||||
public function insertRows(string $tableName, array $newData) : ?int
|
||||
{
|
||||
global $wpdb;
|
||||
$tableName = $wpdb->prefix . $tableName;
|
||||
$wpdb->insert( $tableName, $newData );
|
||||
|
||||
|
||||
if (!$wpdb->insert( $tableName, $newData )) {
|
||||
return null;
|
||||
};
|
||||
return $wpdb->insert_id;
|
||||
}
|
||||
|
||||
@ -29,7 +39,7 @@ class DatabaseHandler {
|
||||
{
|
||||
global $wpdb;
|
||||
$tableName = $wpdb->prefix . $tableName;
|
||||
$wpdb->update( $tableName, $newData, $conditions );
|
||||
return $wpdb->update( $tableName, $newData, $conditions );
|
||||
}
|
||||
|
||||
public function countSqlRows(string $tableName, array $conditions = []) : int
|
||||
|
Reference in New Issue
Block a user