Below is a documented code example showing how to use the MySQL functions to connect and query your database (and check for errors). Please note that using the MySQL extension is NOT RECOMMENDED. This extension is no longer maintained and will be deprecated soon. If you want your scripts to be future proof it is better to switch to MySQLi or PDO.
If there are any questions, or you want to see different features, let me know.