title: MySQL C API: How to work with row from mysql_fetch_row()?
body: <p>This is some example code from my app:</p>
  
  <pre><code>int page_id;
  string page_name;
  
  enum COLUMNS {
      PAGE_ID,
      PAGE_NAME
  };
  
  if (mysql_query(conn, "SELECT page_id, page_name FROM pages")) {
      exit_mysql_error(conn);
  }
  
  MYSQL_RES *res = mysql_use_result(conn);
  
  while (MYSQL_ROW row = mysql_fetch_row(res)) {
      page_id = *(int *)res[PAGE_ID];
      page_name = res[PAGE_NAME];
      // do some stuff where I need the page_id and page_name int/string
  }
  </code></pre>
  
  <p>So imho this isn't the right way to obtain the integer value from the result (yet it works) but I couldn't find good example on how to do it. Also I'm quite new to programming in C++, so any feedback on the code sample is welcome.</p>