1
<?php
   #connect.php connect to the mysql server
   define('DB_HOST','localhost');
   define('DB_PORT', '3306');
   define('DB_NAME', 'cookbook');
   define('DB_USERNAME', 'root');
   define('DB_PASSWORD', '');
   try{
       $dns = 'mysql:host='.DB_HOST.';port='.DB_PORT.';dbname=' . DB_NAME;
       $pdo = new PDO($dns , DB_USERNAME, DB_PASSWORD);
       $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_ASSOC);
       $pdo->exec('set session sql_mode = traditional');
       $pdo->exec('set session innodb_strict_mode = on');
       $stmt = $pdo->prepare('select * from firstNmae');
       $stmt->execute();
       $resute = $stmt->fetchAll();
       echo'<pre>';
       print_r($resute);
       echo '</pre>';
   }
   catch(PDOException $e){
       die(htmlspecialchars($e->getMessage()));
   }

And when tryprint_r(PDO::getAvailableDrivers()); it returns this result Array ( [0] => sqlite )

Mi-Creativity
  • 9,554
  • 10
  • 38
  • 47
  • Welcome to StackOverflow. Please can you properly format the code in your question by making sure there are 4 spaces before every line of code. and be more specific as to what your question is. You can get help with this by checking out (http://stackoverflow.com/help/how-to-ask) – Adam Copley Feb 07 '16 at 03:37
  • 1
    I think omiting port='.DB_PORT.'; work for you – Uttam Kumar Roy Feb 07 '16 at 03:54

0 Answers0