1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4. <head>
5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6. <title>Connect to MySQL</title>
7. </head>
8. <body>
9. <?php // Script 12.1 - mysql_connect.php
10. /* This script connects to the MySQL server. */
11.
12. // Attempt to connect to MySQL and print out messages:
13. if ($dbc = mysql_connect('h41mysql35.secureserver.net', 'yrosenthal', 'Password.1')) {
14.
15. print '<p>Successfully connected to MySQL!</p>';
16.
17. mysql_close(); // Close the connection.
18.
19. } else {
20.
21. print '<p style="color: red;">Could not connect to MySQL.</p>';
22.
23. }
24.
25. ?>
26. </body>
27. </html>