出于某种原因,这段代码没有插入到我的数据库中,我发誓几天前它还在工作。现在,什么都没有。有没有人知道为什么它不起作用?它只是给出任何错误。
$con=mysqli_connect($host,$username,$password,$dbname) or die('Error->' .mysqli_error($con));
function quote2entities($string,$entities_type='number')
{
$search = array("\"","'");
$replace_by_entities_name = array(""","'");
$replace_by_entities_number = array(""","'");
$do = null;
if ($entities_type == 'number')
{
$do = str_replace($search,$replace_by_entities_number,$string);
}
else if ($entities_type == 'name')
{
$do = str_replace($search,$replace_by_entities_name,$string);
}
else
{
$do = addslashes($string);
}
return $do;
}
echo mysqli_error($con);
$c = quote2entities($_POST['company']);
$mem = quote2entities($mem);
$cp = quote2entities($cp);
$vcc = quote2entities($vcc);
$addy = quote2entities($addy);
$contact = quote2entities($contact);
$date = quote2entities($date);
$type = quote2entities($type);
echo $c ;
echo $contact;
echo $vcc;
$query = "INSERT INTO project (company) VALUES (".$c.")";
mysqli_query($con, $query);
mysqli_close($con);