Advertisement
Guest User

Untitled

a guest
Oct 13th, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2.  
  3.     $hostname = 'localhost';
  4.     $username = 'root';
  5.     $password = 'NIGGER';
  6.     $databasename = 'joshdatabase';
  7.    
  8.     $db = new PDO("mysql:host=$hostname;dbname=$databasename",
  9.  
  10. $username, $password,array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES
  11.  
  12. \'UTF8\'') );
  13.  
  14.       $allcars = $db->query('select * from cars' )->fetchAll();
  15.    
  16.     foreach ($allcars as $color => $value)
  17.     {
  18.     echo 'The column color has this color in the database ' .    
  19.  
  20. $value['color'];
  21.     }
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement