When I'm faced with situations like this I start to strip the code down until something starts working and then slowly build it back up until I catch what was causing the issue.
Sometimes that is useful. Often, a better approach is to echo variables at various points to see if the variable has progressed to that point, and what the value is. Then remove the echoed variables when no longer needed.
You can also temporarily turn on error reporting like this:
error_reporting(E_ALL);
ini_set('display_errors', 1);
Also, when you stop using the mysql extension, you will find that PDO gives much better error info--probably mysqli as well.
And Max, you did lead us to believe this was a client project, not a school project. I would have responded to you differently at first if that had been clear. I'm glad this is a school project. Good luck with it.