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

use this code

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