$result = mysql_query( "SELECT * FROM tables_priv") or die("Bad query: ".mysql_error());
You are trying to use a result identifier that is 0. The 0 indicates that your query failed for some reason. You need to check for errors after submitting a query and before you attempt to use the returned result identifier. The proper way to do this is with code similar to the following: