mysql_insert_id() returns 0

According to the manual mysql_insert_id returns: The ID generated for an AUTO_INCREMENT column by the previous query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established. Since it does not give you false and not the correct number it indicates that the queried … Read more

Fatal error: Uncaught exception ‘mysqli_sql_exception’ with message ‘No index used in query/prepared statement’

The fatal error is not in MySQL; the missing index notification is a relatively low-severity warning. The fatal error is in your PHP code, because of the following three conditions: mysqli reports a lot of warnings, even for relatively harmless conditions. You’re throwing mysqli_sql_exception for all errors and warnings due to your mysqli_report(MYSQLI_REPORT_ALL); line. Your … Read more