What does this do exactly: echo mysql_error(); PHP: I've noticed a lot of example scripts talking about echoing that function. But why, since wouldn't apache or whatever server echo it anyway as like a warning?
mysql_error() contains the error message (if there is one) from the most recent mysql query. a lot of times it is beneficial to include this in your error handling of mysql queries so you know what went wrong: Example: mysql_query("SELECT * FROM table") or die(mysql_error()); Code (markup): Say for example that the table "table" does not exist in your database. This script will output and error telling you so and you can easily see what went wrong. Without manually outputing this error, the script simply will not retrieve the data and won't even let you know that there was an error.