0
我的PHP代碼中沒有錯誤:mysqli的PHP沒有插入數據庫,在日誌
<?php
//Connecting to sql db.
$mysqli = new mysqli("127.0.0.1", "admin", "pass", "enedpt_faculties");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
mysqli_set_charset($mysqli,"utf8");
$user = $_POST['user'];
$pass = $_POST['pass'];
$nome = $_POST['nome'];
$apelido = $_POST['apelido'];
$fac = $_POST['fac'];
$data = $_POST['data'];
$email = $_POST['email'];
mysqli_query($mysqli,"`enedpt_faculties`.`users` (`user`, `pass`, `name`, `sname`, `facid`, `nasc`, `mail`)
VALUES ('$user', '$pass', '$nome', '$apelido, '$fac', '$data', '$email')");
?>
出於某種原因,查詢不插入,並有在錯誤日誌中沒有錯誤。請幫忙。
嘗試'echo $ mysqli-> error;'在代碼的末尾! –
你忘記了'INSERT INTO' – bansi
我忘了當我發佈這篇文章,但它已經在,仍然會得到相同的結果 – willier