title: Inserting a variable into a mysql table
body: <p>I know how to insert non variable values into a MySql table (using C++):</p>
  
  <p>Ex:</p>
  
  <pre><code>//Table person:
  mysql_query(conn, "INSERT INTO MyTable VALUES (  '1', 'John', 'Kennedy')");
  mysql_query(conn, "INSERT INTO MyTable VALUES (  '2', 'Dave', 'Chappelle')");
  mysql_query(conn, "INSERT INTO MyTable VALUES (  '3', 'Arnold', 'Schwarzenegger')");
  //Up to 100 rows of data...
  </code></pre>
  
  <p>What I would like to do is be able to insert a variable into a table with C++:</p>
  
  <p>Ex:</p>
  
  <pre><code>i=0;
  for(i=0; i &lt; 100; i++)
  {
  mysql_query(conn, "INSERT INTO MyTable VALUES ( i, 'FirstName', 'LastName')"); 
  }
  </code></pre>
  
  <p>Rather than having to manually type in 100 rows of data,
  I would like to be able to use a for loop, and increment a variable to create the rows for me. </p>
  
  <p>Does anyone know how to insert a variable into a mysql database using C++?</p>