Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $hostname = 'localhost';
- $username = 'root';
- $password = 'NIGGER';
- $databasename = 'joshdatabase';
- $db = new PDO("mysql:host=$hostname;dbname=$databasename",
- $username, $password,array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES
- \'UTF8\'') );
- $allcars = $db->query('select * from cars' )->fetchAll();
- foreach ($allcars as $color => $value)
- {
- echo 'The column color has this color in the database ' .
- $value['color'];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement