我正在尝试将mysqli插入到数据库表中,连接正常,$ _GET ['emailaddress']已填充,表存在,它只是没有插入数据。
$connection = mysqli_connect("localhost","database","password");
mysqli_select_db($connection, "database");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
die;
}else{
echo 'success';
}
mysqli_query($connection, "INSERT INTO `campaign` (`email`) VALUES ('" . $_GET['emailaddress'] . "'");
mysqli_close($connection);
答案 0 :(得分:4)
您缺少1个括号
mysqli_query($connection, "INSERT INTO `campaign` (`email`) VALUES ('" . $_GET['emailaddress'] . "')");