title: Codeigniter Need help about session. select the name of logged in account and insert it into database
body: <p>A PHP Error was encountered
  Severity: Notice</p>
  
  <p>Message: Array to string conversion</p>
  
  <p>Filename: models/event_models.php</p>
  
  <p>Line Number: 524</p>
  
  <p>Backtrace:</p>
  
  <p>File: D:\Xampp\htdocs\CapstoneFiles\application\models\event_models.php
  Line: 524
  Function: _error_handler</p>
  
  <p>File: D:\Xampp\htdocs\CapstoneFiles\application\models\event_models.php
  Line: 536
  Function: getuserinfo</p>
  
  <p>File: D:\Xampp\htdocs\CapstoneFiles\application\controllers\event_user.php
  Line: 30
  Function: join_events</p>
  
  <p>File: D:\Xampp\htdocs\CapstoneFiles\index.php
  Line: 315
  Function: require_once</p>
  
  <p>A Database Error Occurred
  Error Number: 1054</p>
  
  <p>Unknown column 'Array' in 'where clause'</p>
  
  <p>select * from user_profile where user_id=Array</p>
  
  <p>Filename: D:/Xampp/htdocs/CapstoneFiles/system/database/DB_driver.php</p>
  
  <p>Line Number: 691`</p>
  
  <pre><code>public function getuserinfo($user_id) {
      $userdata = $this-&gt;session-&gt;userdata('user_id');
  
      //This is Model
  
      $userid = $this-&gt;db-&gt;escape_str($user_id);
      $sql = "select * from user_profile where user_id=".$userid;
      return $this-&gt;db-&gt;query($sql);
  }
  
  public function join_events($event_id) {
      $data = array(
          'participants_id' =&gt; "",  
          'event_id' =&gt; $event_id,
          'profile_id' =&gt; $this-&gt;event_models-&gt;getuserinfo($this-&gt;session-&gt;user_id)- 
          &gt;row()-&gt;name
      );
      $this-&gt;db-&gt;insert('participants',$data);
  }
  </code></pre>