I have a question that might seem a bit dumb since I have been programming for years and also using MySQL for almost as long.
Do insert queries fail even if the syntax is correct and all the required field values are provided? I was just thinking about this in case the SQL server is busy processing requests, memory is not finite after all.
What kind of safety measures are implemented to prevent such failures? I bit threading is used, but what happens when using PHP is used for example to execute a query?
Since PHP has an execution time limit, does a query get dropped if mysql_query’s time limited is reached before the query is handled by MySQL?
MySQL queries can fail for a variety of reasons aside from syntactical errors. It’s always wise to run checks on queries wherever data integrity is important. In PHP, one way you can do that is to use mysql_affected_rows(). This function tells you how many rows were affected by the previous operation. You can use this function as an indicator of whether a row was successfully inserted, deleted, updated, etc.