title: php - Selecting a query base on the session
body: <p>I have a table <code>users</code> that has <code>user_id</code>,<code>user_firstname</code> And also table <code>borrow</code> that has <code>borrow_book</code>,<code>user_id</code> that is foreign key to the table <code>users</code>.<br> What I want to do is to query the table <code>borrow</code> But only display the sessioned user. Here is my code so far.</p>
  
  <pre><code>&lt;?php 
      $sel_admin =
  "select b.book_title, borrow.borrow_date,u.user_firstname, u.user_lastname, borrow.borrow_remain
  from borrow
  inner join book b 
  on borrow.book_id= b.book_id
  inner join users u 
  on borrow.user_id=u.user_id";
      $rs_admin = mysql_query($sel_admin);
      ?&gt;
  </code></pre>
  
  <p>EDIT: I edited my code</p>
  
  <pre><code>    &lt;?php 
                      session_start();
   $sel_admin =
   "select b.book_title, borrow.borrow_date,u.user_firstname, u.user_lastname,
  borrow.borrow_remain
  from borrow
  inner join book b 
  on borrow.book_id= b.book_id
  inner join users u 
  on borrow.user_id=u.user_id WHERE borrow.user_id ="?&gt;&lt;?php " $_SESSION ['user_id']"; ?&gt;
  </code></pre>
  
  <p>but it still gives me Array to String notice.</p>