If you are on a commercial webhost you probably have phpmyadmin installed. Ask your host about it - it is a great tool. More info can be found at http://phpwizard.net/projects/phpMyAdmin/ . If you are running on Windows, you can test your queries from the mysql monitor.
When I suggested doing a return on the select, I meant adding the line:
return($result_gal);
after the query. This will return the raw output ofthe query. It is ugly, but will give you an idea of what your data will look like. More info can be found here: http://us3.php.net/manual/en/function.return.php
The syntax you posted seems correct. This may seem a little silly, but are there data rows in those tables that have matching category id's?
Change your query to:
$result_gal = mysql_query($sql_gal, $conn_gal) OR DIE (could not select gallery . mysql_error()) ;
Add the following line below the query:
$num_rows = mysql_num_rows($result_gal);
echo "$num_rows were returned";
These two things will tell us whether the query is invalid and therefor not being executed or whether the query is running OK and there are just no results to return.