Last updated: Tue, Oct 31, 2023 11:31 am
Return to Knowledgebase
# | Parameter | Data Type | Required | Description |
---|---|---|---|---|
1 | $table | string | Yes | Name of database table to delete the record from |
2 | $id | integer | Yes | ID of record to be deleted |
// Example: Deleting a record from the 'users' table where the 'id' is 5
$result = $db->deleteById('users', 5);
if($result) {
echo "Deletion successful";
} else {
echo "Deletion failed or no matching record found";
}