MyBB Community Forums
delete query - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: delete query (/thread-180834.html)



delete query - Nineteh - 2015-09-24

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);



RE: delete query - Destroy666 - 2015-09-25

No, it wouldn't work because ST is a string. It should be:
$db->delete_query('settinggroups', "name = 'ST'");



RE: delete query - SvePu - 2015-09-30

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.