Though if you want to make your site look professional, you really should just pay for some real hosting instead of trying to weasel your way out of letting the free hosts make their money (as you're likely legally obligated to do as per the terms of service you undoubtedly "signed"), I'll tell you one of the ways you could do this. But it's anything but ideal, nowhere near as ideal as, say, paying for some real hosting.
Anyhow, one option is to put a PHP script on server B that'll retrieve the results from the database based on a GET request. For example, if your request goes something like "script.php?x=15&y=0&z=weasel", the PHP script (script.php) could run a query that goes, "SELECT * FROM $z WHERE x = $x && y = $y;" Then it could format the values in a way that's easy for yet another PHP script to read.
Here's where the action is: When the PHP script on server A is called, it in turn requests the script on server B that'll return the values from the database. Then the script on server A can parse the data and display it, and we'll all live happily ever after. Except the free host that's getting ripped off.
Oh, and this introduces a lot of other nasty issues -- for example, it could double the downtime for your service, as now you're playing with two servers instead of one. And the biggie, of course, is speed: retrieving a page from another server will never be even remotely as fast as accessing a database on the same server.