为什么下面的代码不向数据库表中插入任何内容?数据库插入不起作用
require_once"connection.php";
$target_Path='img/displays/';
$caption=$_POST['caption'];
$albums=$_POST['albums'];
$target_Path = $target_Path.basename($_FILES['photo']['name']);
move_uploaded_file($_FILES['photo']['tmp_name'], $target_Path);
$withoutExt = preg_replace("/\\.[^.\\s]{3,4}$/", "", $target_Path);
mysqli_query($connection,"INSERT INTO `ett`.`gallery` (`id` ,`album`,`name`,`path`)VALUES (`NULL`,`".$albums."`,`".$caption."`,`".$withoutExt."`)");
下面的代码工作正常,但由于某些原因上述查询不起作用。问题是什么?
mysqli_query($connection,"INSERT INTO `ett`.`gallery` (`id`, `album`, `name`, `path`) VALUES (NULL, '1', 'test', 'test')");
用来看看到你的HTTP服务器错误日志文件,_read_完全问题,而不必_guess_什么。 – arkascha
回应查询,并尝试写入直接数据库,以便您可以确认查询是否正确 – Deep
为什么id始终为空? –