Originally Posted by bullant
I find the easiest and quickest way to check what the actual query about to be run is, is to echo it to the browser and syntax errors should then be fairly obvious.
For more complex queries a good practice imo is to first get the query working in the SQL GUI of your choice and then transfer the query to your server side script.
I agree I frequently test SQL through phpmyadmin to see if it will work as expected and I always use mysql_error() where appropriate too.
It was rather late at night when I created this tip for the noobs so it's not perfect and the SQL was taken from another topic here as it looked like a good example to demonstrate with. Obviously in hindsight I may have got that wrong but hey ho I tried!