I use the C api mysql, however, I encounter an error when I am connected to the database, and I chose the selected item. "Commands out of sync; you can't run this command now"
boolean
check_token(char *token) {
MYSQL_RES *res;
MYSQL_ROW row;
char *pass;
char query[200];
snprintf(query, 200, "SELECT * FROM tokens WHERE token = \"%s\"", token); // SELECT * FROM tokens WHERE token = "84ds4d3d3sd453s"
if (mysql_query(&db, query)) {
fprintf(stderr, "%s\n", mysql_error(&db));
return (FALSE);
}
printf("OK\n");
if (!(res = mysql_store_result(&db))) {
fprintf(stderr, "%s\n", mysql_error(&db));
return (FALSE);
}
if (!(row = mysql_fetch_row(res)))
return (FALSE);
pass = row[1];
printf("Le token est %s\n", pass);
mysql_free_result(res);
return (TRUE);
}
No further requests are made just before. Just the connection to the database that is successful.