Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

PHP Web View Online

<?php
$driver = 'mysql';
$database = "dbname=CODINGGROUND";
$dsn = "$driver:host=localhost;$database";

$username = 'root';
$password = 'root';

try {
   $conn = new PDO($dsn, $username, $password);
   echo "<div>Database CODINGGROUND Connected</div>\n";
}catch(PDOException $e){
   echo $e->getMessage();
}
$sql = 'SELECT  * FROM users';
$stmt = $conn->prepare($sql);
$stmt->execute();

while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
  foreach($row as $value)
  {
    echo '<div>', sprintf("%s, ", $value), '</div>';
  }
  echo "\n";
}
?>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.