title: Using c to insert variables in mysql database
body: <p>I am trying to insert variable calculated in my C program using mysql API . Despite trying all types of tricks( single quote , double quotes , query placeholder)  I am not able to enter the data. The libraries used are:</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;stdlib.h&gt;
   #include &lt;netdb.h&gt;
   #include &lt;netinet/in.h&gt;
   #include &lt;math.h&gt;
   #include &lt;my_global.h&gt;
   #include &lt;mysql.h&gt;
  </code></pre>
  
  <p>The relevant bits of code are</p>
  
  <pre><code>MYSQL *con = mysql_init(NULL);
  
  if (mysql_real_connect(con, "localhost", "test", "test123", 
        "transport", 0, NULL, 0) == NULL) 
  {
     finish_with_error(con);
  }    
  if (mysql_query(con, "INSERT INTO gps_points(vehicle_id,lat,lon,speed) VALUES(unit_id_dec,lat,lon,speed_float)")) 
  {
     finish_with_error(con);
  }
  mysql_close(con);
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>Unknown column 'unit_id_dec' in 'field list'
  </code></pre>
  
  <p>The compile options used are: </p>
  
  <pre><code>sudo gcc socketListen.c -o listenSock -lm `mysql_config --cflags --libs`
  </code></pre>
  
  <p>Any solutions?</p>