title: Is it possible to bindParam a Session variable?
body: <p>What i want to achieve is when the user logs in the users id is saved as the session value, and when the logged in user selects date the products will display based on the date selected ONLY showing from that customer.</p>
  
  <p>To confirm there are 2 issues here: 
  1, How to save user id in Session?, 2, How do i bindParam sessionid?</p>
  
  <p>Here is what i have in terms of code:</p>
  
  <pre><code>When user logs in:
      $_SESSION['customer_loggedin'] = $row['id']; 
  THIS DOES NOT DISPLAY THE ID ON ROW?
  </code></pre>
  
  <p>When user selects the date, Ajax sends to:</p>
  
  <pre><code>session_start();
      include('db_config.php');
      $datepicker = $_POST['dateorderpicker'];
  
      $sql = "SELECT * FROM orders WHERE deliveryDate = ? AND cusomerId= ?"; 
      $stmt = $conn-&gt;prepare($sql);
      $stmt-&gt;bindParam(1, $datepicker, PDO::PARAM_STR);
  
      // HOW DO I BIND PARAM THE SESSION ID?
  
      $stmt-&gt;execute();
      while ($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC))
      {   
          ?&gt;
              &lt;div class="col-sm-4 col-md-4"&gt;
                  &lt;div class="content-boxes style-two top-column clearfix animated flipInY" style="opacity: 1;"&gt;
                  &lt;div class="content-boxes-text"&gt;
                      &lt;h4&gt;&lt;?php echo $row['itemName']; ?&gt;&lt;/h4&gt;
                  &lt;img src="../wholesale/img/sourdough.jpg" class="img-reponsive"&gt;
                  &lt;p&gt;Our best seller.  Full of flavour.&lt;/p&gt;
                  &lt;form class="form-inline pull-right"&gt;
                  &lt;div class="form-group"&gt;
                  &lt;label class="sr-only" for="exampleInputAmount"&gt;Qty&lt;/label&gt;
                  &lt;div class="input-group"&gt;
                  &lt;input type="number" class="form-control" id="exampleInputAmount" placeholder="&lt;?php echo $row['qty']; ?&gt;"&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;button type="submit" class="btn btn-primary"&gt;Update&lt;/button&gt;
                  &lt;/form&gt;
                  &lt;/div&gt;
                 &lt;/div&gt;
                &lt;/div&gt;
          &lt;?php
      }
  </code></pre>
  
  <p>If there is any other information you need please feel free to ask. 
  I am still learning so if you see something that is not right please let me know so i can better my php :)
  Thanks</p>
  
  <pre><code>    if($login &amp;&amp; $password)
      {
          $sql = "SELECT * FROM customer WHERE (code=:code OR phone=:phone OR businessName=:businessName OR email=:email) AND password=:password";
          $stmt = $conn-&gt;prepare($sql);
          $stmt-&gt;bindValue(':code', $login, PDO::PARAM_STR);
          $stmt-&gt;bindValue(':phone', $login, PDO::PARAM_STR);
          $stmt-&gt;bindValue(':businessName', $login, PDO::PARAM_STR);
          $stmt-&gt;bindValue(':email', $login, PDO::PARAM_STR);
          $stmt-&gt;bindValue(':password', $password, PDO::PARAM_STR);
          $stmt-&gt;execute();
          $num = $stmt-&gt;fetchColumn();
          if($num &gt; 0)
          {
          $_SESSION['customer_loggedin'] = $row['id'];
              header('location:order.php');
          }
          else{
              header('Location:index.php');
              $_SESSION['errmsg'] = 'Incorrect Login Details';
              die;
          }
      }
  }  
  </code></pre>