daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Oct 22nd, 2017 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Notice: Undefined variable: results in C:xampphtdocsTest WebsiteIncludesdatabaseconnect.php on line 25
  2.    
  3. $dbServername = "localhost";
  4. $dbUsername = "root";
  5. $dbPassword = "";
  6. $dbName = "phplessons";
  7.  
  8. $conn = new mysqli($dbServername, $dbUsername, $dbPassword, $dbName);
  9.  
  10. if ($conn->connect_errno) {
  11.   printf("Connection failed %sn", $conn->connect_error);
  12.   exit();
  13. }
  14.  
  15. $id = 8;
  16. $stmt = $conn->prepare("Select * FROM posts WHERE ID=?");
  17. $stmt->bind_param("d", $id);
  18. $stmt->execute();
  19. $result = $stmt->get_result();
  20.  
  21. while ($row = $result->fetch_object()) {
  22.   $results[] = $row;
  23. }
  24.  
  25. print_r($results);
  26.  
  27. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top