Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*** mysql hostname ***/
- $hostname = 'localhost';
- /*** mysql username ***/
- $username = 'root';
- /*** mysql password ***/
- $password = 'MYPASS';
- try {
- $dbh = new PDO("mysql:host=$hostname;dbname=radio1test", $username, $password);
- /*** echo a message saying we have connected ***/
- /*** The SQL SELECT statement ***/
- $sql = "SELECT * FROM animals";
- foreach ($dbh->query($sql) as $row)
- {
- echo $row['presenter'] .' - '. $row['show'] . '<br />';
- }
- /*** close the database connection ***/
- $dbh = null;
- }
- catch(PDOException $e)
- {
- echo $e->getMessage();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment