您是否检查过mysqli_query()的返回值?如果发生错误,则返回FALSE。在这种情况下,mysqli_error()会为您提供有关该错误的更多信息。
<?php$con = mysqli_connect("localhost", "root", "", "test");if (mysqli_connect_errno()) { printf("Connect failed: %sn", 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: %sn", mysqli_error($con));}else { echo 'done.';}


