title: Dynamic SQL queries in code possible?
body: <p>Instead of hard coding sql queries like <code>Select * from users where user_id =220202</code> can these be made dynamic like <code>Select * from $users where $user_id = $input.</code></p>
  
  <p>Reason i ask is when changes are needed to table/column names i can just update it in one place and don't have to ask developers to go line by line to find all references to update. It is very time consuming. And I do not like the idea of exposing database stuff in the code. </p>
  
  <p>My major concern is load time. Like with dynamic pages, the database has to fetch the page content, same way if queries are dynamic first system has to lookup the references then execute the queries, so does it impact load times?</p>
  
  <p>I am using codeignitor PHP.</p>
  
  <p>If it is possible then the next question is where to store all the references? In the app, in a file, in the DB, and how?</p>
  
  <p>---EDIT:<br>
  <strong>Even better: Can the SQL query itself be made dynamic? I can just reference $sqlA instead of the whole query? This way if I have to re-write the query I can just update 1 file.</strong></p>