Using this nice little piece of code, you can find out exactly what's going into the mysql engine. This makes it much easier, as you can see what, if any, flaws there are in the script, and it can also report how the mysql engine responded.