我是 mysql 查询的新手,只是无法将此 mysqli 语句插入 mysql。我的脚本设置或我的 $sql 有问题吗?(虽然我没有收到任何错误,只是没有插入)
<?php
$login = "coolkidz"; //this line insets into username
$sname = "heyu";
$city = "beautiful";
$empass = "awesome";
$eusername = "what";
$mcode = "nice";
$sql = "INSERT INTO login(sname, city, empass, eusername, mcode, username) VALUES('$sname', '$city', '$empass', '$eusername', '$mcode', '$login')");
$hostname_Database = "censored";
$database_Database = "censored";
$username_Database = "censored";
$password_Database = "censored";
$mysqli = new mysqli($hostname_Database, $username_Database, $password_Database, $database_Database);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$result = $mysqli->query($sql);
if (!$result) {
printf("%s\n", $mysqli->error);
exit();
}
?>