title: Variable as column name in select query
body: <p>I want to select the name contained in the column with the same name as my variable $column_id, which I pass to the function displayed below. It's passed correctly but without putting the '' around it the query results in an error. If I put them the result of the select is the value of $column_id itself, which is wrong. (the syntax equals to the one for prepared queries because that's the next step, if I can fix this issue)</p>
  <pre><code>$nirk2 = $this-&gt;conn-&gt;prepare(&quot;SELECT '&quot; .$column_id. &quot;' FROM t_values WHERE device_id='&quot;.$device_id.&quot;'&quot;);
  $nirk2-&gt;execute(); 
  $nirk2-&gt;bind_result($Value_Description);
  $nirk2-&gt;fetch();
  </code></pre>
  <p>All I want to do is basically use my variable $column_id as name of the column to search the value in.</p>