Guest User

Untitled

a guest
Jan 27th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. require 'database.php';
  6.  
  7.  
  8. if( isset($_SESSION['user_id']) ){
  9.  
  10. $records = $conn->prepare('SELECT id,email,password,curvouch,fname FROM users WHERE id = :id');
  11. $records->bindParam(':id', $_SESSION['user_id']);
  12. $records->execute();
  13. $results = $records->fetch(PDO::FETCH_ASSOC);
  14.  
  15. $user = NULL;
  16.  
  17. if( count($results) > 0){
  18. $user = $results;
  19. }
  20.  
  21.  
  22. }
  23. ?>
  24. <?php
  25.  
  26. <div class="form-group" action="profile.php" method="POST">
  27. <label for="exampleInputEmail1">Email address</label>
  28. <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email" name="email">
  29. <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
  30. </div>
  31. <button type="submit" class="btn btn-primary">Submit</button>
  32. </form>
  33.  
  34. <?php
  35. $server = 'localhost';
  36. $username = 'HIDDEN';
  37. $password = 'HIDDEN';
  38. $database = 'HIDDEN';
  39.  
  40. try{
  41. $conn = new PDO("mysql:host=$server;dbname=$database;", $username, $password);
  42. } catch(PDOException $e){
  43. die( "Connection failed: " . $e->getMessage());
  44. }
  45.  
  46. Fatal error: Uncaught Error: Call to a member function execute() on null in /
Add Comment
Please, Sign In to add comment