Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. Fatal error: Uncaught Error: Call to a member function bindParam() on string
  2. in C:xampphtdocssignregister.php:20 Stack trace: #0 {main} thrown in
  3. C:xampphtdocssignregister.php on line 20
  4.  
  5. <?php
  6. include('connection.php');
  7. $form = $_POST;
  8. $username = $form['username'];
  9. $password = $form['password'];
  10. $repass = $form['repass'];
  11. $email = $form['email'];
  12. $date = $form['date'];
  13. $month = $form['month'];
  14. $year = $form['year'];
  15. if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  16. echo "Invalid email please type a valid one";
  17. }
  18. else{
  19. if($username !='' && $password !='' && $repass!='' && $email !='' &&
  20. $date!='' && $month !='' && $year !='')
  21. {
  22. if($password == $repass)
  23. {
  24. $query = "SELECT * FROM users where email = :email AND username =
  25. :username";
  26. $query->bindParam(':username',$username);
  27. $query->bindParam(':email',$email);
  28. $count1 = $query->rowCount();
  29. if($count> 0)
  30. {
  31. echo "soryy the email you are trying to register is already
  32. registered!";
  33. }
  34. else{
  35.  
  36. $insert = $connection->prepare("INSERT INTO users
  37. (username,password,email,date,month,year) values (:username, :password,
  38. :email, :date, :month, :year)");
  39. $insert->bindParam(':username',$username);
  40. $insert->bindParam(':password',$password);
  41. $insert->bindParam(':email',$email);
  42. $insert->bindParam(':date',$date);
  43. $insert->bindParam(':month',$month);
  44. $insert->bindParam(':year',$year);
  45. $out = $insert->execute();
  46. if(isset($out)){
  47. echo "thankyou you have sucessfully registered";
  48. }
  49. else{
  50. echo " sorry some error occured please try again!";
  51. }
  52. }
  53. }
  54. else{
  55. echo " passwords do not match";
  56. die();
  57. }
  58. }
  59. else{
  60. echo " you have not filled the registration form completely so please it";
  61. }
  62. }
  63. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement