title: Getting Illegal string offset 'uid'
body: <p>Please dont marked as DUPLICATE. I know there are a lot of posts with these error but none seem to be the same issue as mine.</p>
  
  <p>What I am trying to do is to pull up data based on a uid/date from/date to. The UID is related to a login session where it represents the user's ID. </p>
  
  <p>Here is my HTML code,</p>
  
  <pre><code>&lt;input type="text" readonly name="uid" id="uid" value="&lt;?php echo $_SESSION['myusername']; ?&gt;" /&gt;
  &lt;input type="date" name="from" id="from" value="&lt;?=$date['from']; ?&gt;" /&gt;
  &lt;input type="date" name="to" id="to" value="&lt;?=$date['to']; ?&gt;" /&gt;
  &lt;input type="submit" value="Submit" /&gt;
  </code></pre>
  
  <p>So from the code above, UID is a read-only and user can only select dates. So by default user can only get data from db with his own UID using different set of dates.</p>
  
  <p>Here is my SQL code,</p>
  
  <pre><code>if($date['from'] !== NULL &amp;&amp; $date['to'] !== NULL){
      // get table data
      $sql = 'SELECT `id`, `changeid`, `implemented_by`
      FROM `tracker` WHERE `implemented_by` = $uid `scheduled_start_date` BETWEEN :d1 AND :d2';
      $stmt = $conn-&gt;prepare($sql);
      $stmt-&gt;bindParam(':uid', $uid['uid'], PDO::PARAM_STR);
      $stmt-&gt;bindParam(':d1', $date['from'], PDO::PARAM_STR);
      $stmt-&gt;bindParam(':d2', $date['to'], PDO::PARAM_STR);
      $stmt-&gt;execute();
      $result = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
  </code></pre>
  
  <p>Now, every time I click on Submit button to retrieved the data I am getting this error,</p>
  
  <p><code>Warning: Illegal string offset 'uid' in C:\*\update_status_test.php on line 130</code></p>
  
  <p><code>Fatal error: Only variables can be passed by reference in C:\*\update_status_test.php on line 130</code></p>
  
  <p>Line 130 refers to below,</p>
  
  <pre><code>$stmt-&gt;bindParam(':uid', $uid['uid'], PDO::PARAM_STR);
  </code></pre>
  
  <p>Can anyone help me understand why its giving such an error, I'm new to PHP and cant seem to comprehend the error.</p>