title: Too few arguments to function CI_DB_query_builder::join(), 1 passed and at least 2 expected using join table in PHP(Codeigniter)
body: <p>I am trying to reduce all my methods in my model so I decided to make it a dynamic. Done in creating a dynamic for insert,update,fetch,delete but having a problem in creating a dynamic for joining 2 tables.  </p>
  
  <p>Error encountered:</p>
  
  <blockquote>
    <p>"Too few arguments to function CI_DB_query_builder::join(), 1 passed
    in C:\xampp\htdocs\snapmatic\application\models\Crud_model.php on line
    130 and at least 2 expected"`</p>
  </blockquote>
  
  <p>NOTE: In this project, the module i'm doing is "following" where a user can follow a specific person(like instagram). I have 2 tables named: users and following. </p>
  
  <p>In my "following table", my columns are: id, user_id and user_following. The user_id is where the account logged in and the user_following is the one you've followed. </p>
  
  <pre><code>Scenario: In my table users, you have 2 data: Person 1 and Person 2
  Person 1 account is logged in then Person 1 followed Person 2.
  </code></pre>
  
  <p>After Person 1 clicked the button follow, in my table of following will look like this:</p>
  
  <pre><code>id: 1 user_id: 1 user_follow:2
  </code></pre>
  
  <p><strong>THIS IS MY Controller</strong></p>
  
  <pre><code>$id = $this-&gt;session-&gt;user_id;
  $where = array('following.user_id =&gt; $id');
  $join  = array('following,following.user_following = users.id');
  $fetch_following = $this-&gt;Crud_model-&gt;join_table('*','users',$where,$join);
  
  //Also tried these
  //$where = "('following.user_id', $id)";
  //$where = "'following.user_id', $id)";
  //$where = "('following.user_id, $id')";
  //$where = "'following.user_id, $id'";
  //$join  = "'following,following.user_following = users.id'";
  //$join  = "('following,following.user_following = users.id')";
  //$join  = "('following','following.user_following' = 'users.id')";
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>public function join_table($tag,$table,$where,$join){
      // public function join_table($id){
  
          $this-&gt;db-&gt;select($tag);
          $this-&gt;db-&gt;from($table);
          $this-&gt;db-&gt;join($join);
  
          $this-&gt;db-&gt;where($where);
          // $this-&gt;db-&gt;select('*');
          // $this-&gt;db-&gt;from('users');
          // // $this-&gt;db-&gt;group_by('invoice_number'); 
          // $this-&gt;db-&gt;join('following','following.user_following = users.id');
          // $this-&gt;db-&gt;where('following.user_id', $id);
          $result = $this-&gt;db-&gt;get();
          return $result-&gt;result();
      }
  </code></pre>
  
  <p>The comment part is working but I would like to make it a dynamic.</p>
  
  <p>Question: How to make a dynamic method for joining a table?</p>