Har du kontrollerat returvärdet för mysqli_query()? Den returnerar FALSK om ett fel inträffade. I så fall mysqli_error() ger dig mer information om felet.
<?php
$con = mysqli_connect("localhost", "root", "", "test");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "INSERT INTO files VALUES (NULL, 5, 'hello')";
echo "<pre>Debug: $query</pre>\m";
$result = mysqli_query($con, $query);
if ( false===$result ) {
printf("error: %s\n", mysqli_error($con));
}
else {
echo 'done.';
}
\m";$result =mysqli_query($con, $ query);if (false===$result ) { printf("error:%s\n", mysqli_error($con));}else { echo 'done.';}