MyBB Community Forums

Full Version: delete query
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am trying to delete a row out of my settinggroups table (using PHP), the name is "ST".

Could someone please tell me the code I'd use to do this?

Thankyou in advance.

Edit: Would this maybe work?

$rowDel = "ST";
	$db->delete_query('settinggroups','name='.$rowDel);
No, it wouldn't work because ST is a string. It should be:
$db->delete_query('settinggroups', "name = 'ST'");
I guess with variables it is also possible, like:
$rowDel = "ST";
$db->delete_query('settinggroups', "name='".$rowDel."'"); 
//or
$db->delete_query('settinggroups', "name='{$rowDel}'"); 

But if you have only one string, the best way is like Destroy666 said.