Look at how you get it into the site:
<link rel='stylesheet' type='text/css' href='a_style.php' >. This is a client side fetch, not a server side one. PHP and the webserver has done its job already, and sent the HTML to the client. The client then sees the external href for the stylesheet and requests that the server provides a_style.php.
So as mentioned, completely independent requests.
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php