title: INSERT INTO TABLE .. php - variable in sql query
body: <p>I have php script containing following SQL query (working oK):</p>
  
  <pre><code>$query = 'INSERT INTO persons'.
     '(name,
       surname
       )'.'VALUES
       ( "'.$_REQUEST["name"].'",
         "'.$_REQUEST["surname"].'"
       )';  
  </code></pre>
  
  <p>Where $_REQUEST["name"] and $_REQUEST["name"] are variables passed from html form.<br>
     usin php 4.5 and MariaDB 5.5</p>
  
  <p>Problem rises when i try to substitute persons by variable - eg. $table:</p>
  
  <pre><code>$table = "persons";
  
  $query = 'INSERT INTO '.$table.''.
     '(name,
       surname
       )'.'VALUES
       ( "'.$_REQUEST["name"].'",
         "'.$_REQUEST["surname"].'"
       )'; 
  </code></pre>
  
  <p>I have been trying different variations with double qutes/single qutes/dots :). But still struggling with this.. 
  Thx for possible answer. </p>