trouble with selecting from database with codeigniter
<p>I am trying to select info from my database with codeigniter. Here is the code:</p>
<pre><code>public function getContent($table_name){

  $show = false;
  $sql = 'SELECT * FROM ?';
  $query = $this-&gt;db-&gt;query($sql, array($table_name));
    if($query-&gt;num_rows &gt; 0){
      $show = $query-&gt;result_array();
    }
  return $show;
  }
</code></pre>
<p>I get an error from mysql:</p>
<blockquote>
<p>Error Number: 1064</p>
<p>You have an error in your SQL syntax; check the manual that corresponds to your &gt;MySQL server version for the right syntax to use near ''main_db'' at line 1</p>
<p>SELECT * FROM 'main_db'</p>
<p>Filename: C:\xampp\htdocs\Staz1\system\database\DB_driver.php</p>
<p>Line Number: 331</p>
</blockquote>
<p>I think that the problem is that the query has 'main_db' with apostrophes. When writing the query directly into the sql section in phpmyadmin that was the problem that I encountered (it only works if written with no apostrophes or with backticks).</p>
<p>If this is indeed the issue - how do I send the query without the apostrophes?</p>