title: C++ how to get a filed value from sql statment into variable
body: <p>I am tring to run a &quot;SELECT&quot; command on an sql database and store the field into a variable through a &quot;callback&quot; function but I have now idea how to do that. Someone know what I need to add to my code so it will work?.</p>
  <p>this is the relevant part of the code:</p>
  <pre><code>int callback(void* data, int argc, char** argv, char** azColName)
  {
      // here I want to store the field value into the &quot;data&quot; variable so I will be able to use it later in the code.
      data = argv[0];
      std::cout &lt;&lt; argv[0];
      return 0;
  }
  
  void DatabaseAccess::tagUserInPicture(const std::string&amp; albumName, const std::string&amp; pictureName, int userId)
  {
      int* albumId = nullptr;
      int res = 0;
      std::string sqlCommand1 = &quot;SELECT ID FROM ALBUMS WHERE NAME='&quot; + albumName + &quot;';&quot;;
      res = sqlite3_exec(this-&gt;db, sqlCommand1.c_str(), callback, &amp;albumId, nullptr);
      std::cout &lt;&lt; *albumId;
  }
  
  </code></pre>
  <blockquote>
  <p>the &quot;tagUserInPicture&quot; function working fine.</p>
  </blockquote>