title: strtotime() expects parameter 1 to be string, array given in codeigniter
body: <p>I am assigning a token to user when he logs in, this token will be stored in database and will expire within 12 hours.</p>
  <p>For this when the user logs in it will be shown in a view,</p>
  <p>**my view is **</p>
  <pre><code>&lt;a href=&quot; &lt;?php echo site_url('admin/checkval') ?&gt; &quot;&gt;check valididty of token&lt;/a&gt;
  </code></pre>
  <p>when he clicks on this,</p>
  <p><strong>My Controller</strong></p>
  <pre><code>public function checkval(){
  
      $this-&gt;load-&gt;library('session');
  
      $goal = $this-&gt;session-&gt;userdata('user_id');
      $uid = $goal[0];
      $token = $goal[1];
      $this-&gt;load-&gt;model('loginmodel');
  
      $check_id = $this-&gt;loginmodel-&gt;token_valid($uid, $token);
      if($check_id){
        $data['query'] = $this-&gt;loginmodel-&gt;get_last_ten_entries();
         $this-&gt;load-&gt;view('admin/account', $data);
         print_r($data);
        echo &quot;valid&quot;;
      }else {
          echo &quot;invalid&quot;;
      }
  
  
   }
  </code></pre>
  <p>if his token is valid he will be shown list of users</p>
  <p><strong>model</strong></p>
  <pre><code>public function token_valid($uid, $token){
  
    $responce = $this-&gt;db-&gt;query(&quot;SELECT expired_at FROM user_auth 
                                  WHERE id = '$uid' AND token = '$token'&quot;);
    $date = strtotime($responce-&gt;result());
    echo &quot;$date&quot;;
    $cdate = date(&quot;Y-m-d H:i:s&quot;);
    $cdate = strtotime($cdate);
    $interval = date_diff($date,$cdate);
    $hour = $interval-&gt;h;
    if(h&lt;12){
      return TRUE;
    }else {
    return FALSE;  // code...
    }
  
  }
  </code></pre>
  <p><strong>database</strong></p>
  <p>In user_auth table i have,</p>
  <pre><code>id int(50),token varchar(500),expired_at datetime
  </code></pre>
  <p>but when i do this, the error occurs as follows,</p>
  <blockquote>
  <p>strtotime() expects parameter 1 to be string, array given</p>
  <p>date_diff() expects parameter 1 to be DateTimeInterface, boolean given</p>
  <p>Trying to get property of non-object0</p>
  <p>Use of undefined constant h - assumed 'h'</p>
  </blockquote>
  <p>I think once the first error is resolved, others will go away.
  How do i do that? What am i doing wrong here?
  Thank you for your suggesions</p>