title: Fatal error: Call to a member function bind_param()
body: <p>I am getting the following error message:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function bind_param() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/ict136/aaregistration/register/register.php on line 89</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php include('header.php'); ?&gt;
  
  
  &lt;!-- start of content --&gt;
  &lt;div class="container"&gt;
  
      &lt;form role="form" action="" method="POST"&gt;
            &lt;div class="row"&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
                &lt;div class="col-md-4"&gt;&lt;h3&gt;&lt;center&gt;&lt;strong&gt;Member Registration&lt;/strong&gt; &lt;/center&gt;&lt;/h3&gt;&lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="row"&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;input type="text"       required name="fullname"   id="fullname"                placeholder="enter full name"&gt;&lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
              &lt;/div&gt;
  
                &lt;div class="row"&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;input type="text"       required name="address"     id="fullname"               placeholder="enter address"&gt;&lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
              &lt;/div&gt;
  
             &lt;div class="row"&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
                &lt;div class="col-md-4"&gt;&lt;input type="email"       required name="email"       id="exampleInputEmail1"     placeholder="Enter email"&gt;&lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
            &lt;/div&gt;
              &lt;div class="row"&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;input type="date"       required name="bday"        id="exampleInputDate1"              placeholder="(YYYY-MM-DD)"&gt;&lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
            &lt;/div&gt;
  
             &lt;div class="row"&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;input type="password"   required name="password"    id="exampleInputPassword1"  placeholder="Password"&gt;&lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
            &lt;/div&gt;
                     &lt;div class="row"&gt;
                &lt;div class="col-md-4"&gt;&lt;/div&gt;
                &lt;div class="col-md-4"&gt;  &lt;button type="submit" name="submit" value="submit" class="btn btn-default"&gt;Submit&lt;/button&gt;&lt;/div&gt;
                &lt;div class="col-md-4"&gt;&lt;/div&gt;
            &lt;/div
             &lt;div class="row"&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
                &lt;div class="col-md-4"&gt;
                &lt;?php
                   if(isset($_POST['submit'])){
                   echo "Thank you for registering  ".$_POST['fullname']."!";
  
  
                   //assigning the values from the form to the variables after cleaning
                   $name=$_POST['fullname'];
                   $address=$_POST['address'];
                   $email=$_POST['email'];
                   $happybday=$_POST['bday'];
                   $pword=$_POST['password'];
  
  
  
  
                   //open a connection to the database
                   $con=mysqli_connect("localhost","root","","firstmatesales") ;
  
                  //checking if it is successful
  
                  if(mysqli_connect_errno())
                  {
                  //greater than 0 - has error
  
                  echo "&lt;br/&gt;Error connecting to database hehehe";
                  exit();
                  }else
                           {
                 //0 means false - no error
                  echo "&lt;br/&gt;Well played! connected to database!";
  
                  $sqlstmt="insert into firstmatesales(customername,customeraddress,customeremail,customerbirthday,password) values(?,?,?,?,?)";
  
                   //$name=$_POST['fullname'];
                   //$address=$_POST['address'];
                   //$email=$_POST['email'];
                  //$happybday=$POST['bday'];
                   //$pword=$_POST['password'];
  
  
                  $stmt=$con-&gt;prepare ($sqlstmt);
   &lt;!--line 89--&gt; $stmt-&gt;bind_param('sssss', $name, $address, $email, $happybday, $pword);
                  $stmt-&gt;execute();                
                            }
  
                   }
                   else
                   {
                    echo "please register your information";
                    }
                ?&gt;
  
                &lt;/div&gt;
                &lt;div class="col-md-4"&gt; &lt;/div&gt;
            &lt;/div&gt;
      &lt;/form&gt;
  
  &lt;/div&gt;   
  &lt;!-- end of content --&gt; 
  
  &lt;?php include('footer.php'); ?&gt;
  </code></pre>