我在我的网站上有一个表单提交数据到我的(mysql)数据库。这是通过Mysqli完成的。提交表单后,我收到以下消息:MySQLi插入到插入0?
“inputoftextboxhere”已添加到数据库!
但是,当我看到在我的数据库只有一个insert.php
<?php
//config bestand ophalen.
require_once 'config.php';
if(isset($_POST['submit']))
{
$email = $mysqli->real_escape_string($_POST['email']);
$sql = "INSERT INTO maillist (id, email) VALUES ('', '$email')";
if ($mysqli->query($sql))
{
echo "<center><div class='alert alert-success' role='alert'>".$email." is succesvol toegevoegd aan de database!</div></center>";
}
else
{
echo "Error: " . $sql . "<br>" . $mysqli->error;
}
$mysqli->close();
}
?>
值的index.php数据库的
<form action="insert.php" method="post" accept-charset="utf-8" class="form" name="submit">
<legend>Email </legend>
<input type="text" name="email" value="" class="form-control input-lg" placeholder="E-mail" /><br />
<button class="btn btn-lg btn-primary btn-block signup-btn" name="submit" type="submit">Voeg nummer toe</button>
</form>
截图: https://gyazo.com/9ec48d3ce4ec6643d8fbcb2f3db42052
显示config.php – Mihai
只有几行数据库详细信息。不要以为你需要他们。 ;) – Mand
此外,表定义和检查触发器。有时人们连接到MySQL,这就是为什么我问。 – Mihai