Guest User

Untitled

a guest
Dec 10th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <title>testing pdo</title>
  4. <body>
  5. <?php
  6.  
  7. /*
  8. $db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
  9.  
  10. $db->prepare('select * from trying;');
  11.  
  12. $sqlite="sqlite:test.sqlite";
  13.  
  14. try {
  15. $pdo = new PDO($sqlite);
  16. } catch(PDOException $e) {
  17. die ('Connection to ' . $database . ' failed.');
  18. }
  19.  
  20. $sql = "select * from trying;";
  21. $search = $pdo->prepare($sql);
  22. $search->execute();
  23.  
  24. echo $db;
  25.  
  26. */
  27.  
  28. /* echo exec('`which mysql_config` --socket'); */
  29.  
  30. /* mysql version -- not working.*/
  31.  
  32. $dbname = 'x';
  33. $user = 'x';
  34. $pass = 'x';
  35. $server = 'x';
  36.  
  37.  
  38. try {
  39.  
  40. # MySQL with PDO_MYSQL
  41. $DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
  42.  
  43. }
  44. catch(PDOException $e) {
  45. echo 'Oops ' . $e->getMessage();
  46. }
  47.  
  48.  
  49.  
  50. ?>
  51. </body>
  52. </html>
Add Comment
Please, Sign In to add comment