The part of the code where the connection to the database occurs.

MYSQL *connection, mysql; MYSQL_RES* result; MYSQL_ROW row; int query_state; MYSQL* Connection() { mysql_init(&mysql); connection = mysql_real_connect(&mysql, "localhost", "root", "6592", "test1", 3306, 0, 0); if (connection == NULL) { cout << mysql_error(&mysql) << endl; } return connection;} 

Here is the request code:

 void InTable() { string request = "insert into test value(1);"; query_state = mysql_query(connection, request.c_str()); result = mysql_store_result(connection); mysql_free_result(result);} 

Here in this line result = mysql_store_result(connection); It gives an error that is below. How can I fix it?

  • Here is the request code The code is syntactically erroneous. Must be value s . And the test table should have exactly one field that can take the value 1. - Akina
  • Here in this line result = mysql_store_result(connection); It gives an error . An INSERT request does not return a recordset. This is so, by the way ... - Akina
  • @Akina corrected the request, but it did not help. It seems to me that this is something from visual studio. - walde

0