if (mysql_query(connection, command.c_str()) != 0) { cout << "Error: " << mysql_error(connection) << "\n"; ... }