title: How to save an SQL query result in C/C++
body: <p>I am new too programming. 
  How can i save the result of the query "SELECT Gewenstetempratuur FROM SensorValue" as an int variable so i can use it later.
  I am using a mysql database.</p>
  
  <pre><code>#include &lt;unistd.h&gt;   
  #include &lt;stdio.h&gt;    
  #include &lt;mysql.h&gt; 
  #include &lt;my_global.h&gt;
  
  int main (int argc, char* argv[]){
  //the for loop is so ite gets updated frequently 
  for(;;){
      MYSQL *conn;
      MYSQL_RES *result;
      MYSQL_ROW row;
  
          //Conection Values
          char *server = "server";
          char *user = "user";
          char *password = "pass";
          char *database = "database";
  
          //Making the connection to the database
          conn = mysql_init(NULL);
          if (!mysql_real_connect(conn, server,
          user, password, database, 0, NULL, 0)) {
          fprintf(stderr, "%s\n", mysql_error(conn));
          }
          //The query i want to save the result from
          //"SELECT Gewenstetempratuur FROM SensorValue"
  
      usleep(1000000);
      }
  }
  </code></pre>