Delete
This is for the deleting a row in the table. The $whereParams
is optional only.
// DB()->delete($table, $whereParams = '');
<?php
namespace App\Controllers;
class UserController
{
public function destroy()
{
$user_id = Auth::user('id');
DB()->delete('users', "id = '$user_id'");
}
}
Always remember that the delete
method return a integer result, if the result is 1
it is true then 0
is false. False if the query produce an error and true if the query is successfully executed against the database.
Last updated