Advertisement
Guest User

this thing

a guest
Mar 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2. $sqlLine = 'SELECT * FROM users WHERE username = "jasonnross"';
  3.  
  4.  
  5.  
  6.  
  7. function DBCommand ($sqlLine) {
  8.  
  9.     $sql_servername = "sched.rossware.net";
  10.     $sql_username = "Jason";
  11.     $sql_password = "4lGBIzjnwn0rPuOn";
  12.     $sql_database = "JasonDev";
  13.  
  14.     $dsn = "'mysql:host='.$sql_servername.';dbname='.$sql_database';charset=utf8mb4'";
  15.  
  16.     try
  17.     {
  18.         $pdo = new PDO('mysql:host='.$sql_servername.';dbname='.$sql_database,$sql_username,$sql_password);
  19.         // set the PDO Error mode to exception
  20.         //echo "Connected successfully";
  21.     }
  22.     catch (PDOException $e)
  23.     {
  24.     echo "Connection failed: " .$e->getMessage();
  25.     }
  26.  
  27.     // $stmt = $pdo->prepare('SELECT * FROM users WHERE username = "jasonnross"');
  28.     $stmt = $pdo->prepare($sqlLine);
  29.     $stmt->execute();
  30.  
  31.     if ($stmt->rowCount() > 0) {
  32.         $result="yes";
  33.         //echo "yes";
  34.     } else {
  35.         //echo "no";
  36.         $result="no";
  37.     }
  38.     return $result;
  39. }
  40.  
  41.  
  42. DBCommand($sqlLine);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement