PHP mysqli在数据库中查找并删除所有与搜索相关的记录

PHP mysqli在数据库中查找并删除所有与搜索相关的记录

问题描述:

looking for a little help, Im tring to write a search and delete code in php for databases

i need to do a search in a database and delete all found items "rows" what i have been do is calling the table one by one and deleting the affected row. im thinking there has to be a better way then this??

if you have any ideas this would be greatful

cheers thanks

寻求一些帮助,我想在php中为数据库写一个搜索和删除代码 p> \ n

我需要在数据库中进行搜索并删除所有找到的项目“行” 我一直在做的是逐个调用表并删除受影响的行。 im认为必须有一个 更好的方式呢? p>

如果您有任何想法,这将是非常好的 p>

欢呼谢谢 p> div>

use this code

$search = $_POST['txtboxname'];
mysqli_query("DELETE FROM tablenaem WHERE name like '%$search%'");