我需要将搜索结果插入到一个表中,我已经完成了获取任何值的名称,但我很难将它们插入到表中。这是一些代码:
<?php
$con=mysqli_connect("localhost", "root", "", "library");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//var_dump($_POST['genre']);
$genres = $_POST['genre'];
foreach ($genres as $k=>$v){
$rslt="INSERT INTO 'history'(id,name)
VALUES('NULL', '".$k."')";
}