Please read and follow Paradox814's post at this thread:
http://www.daniweb.com/techtalkforums/thread25821.html
It will show you some basics of running mysql queries in PHP along with how to read the mysql errors. Use the techniques shown to modify how you run your queries. Create a page that only has the problem--nothing else. Keep the chunk you are working on as small as possible. When you get it working, add one step to it, and test again.
If you run into one step that you can't get working, then post here with just enough information to make your question clear. Most people answering posts don't have time to read entire code modules and debug for you.
Enjoy the journey. [img]dani-images/smilies/fiyellow/icon_smile.gif[/img]