Im new to c++ and I have been playing with it and mysql, few months ago I did a program that worked fine but now I crashes because mysql_store_result is returning NULL when it shouldn't (If I'm not wrong)
//Executes query
if (!mysql_query(mysql, checkIpQuery.c_str()))
{
if (debug) {
fprintf(stderr, "%s\n", mysql_error(mysql));
}
}
res = mysql_store_result(mysql);
int num_fields = mysql_num_fields(res);
if ((row = mysql_fetch_row(res)))
{
//CODE
}
}
}
When I run this I get this error:
Exception thrown at 0x0FDE1B06 (libmysql.dll) in ArhCore.exe: 0xC0000005: Access violation reading location 0x0000004C.
In this line: int num_fields = mysql_num_fields(res);
I read that I'm getting this error because mysql_store_result is NULL. Any idea of what is happening or what am I missing? Last time I coded was really long time ago and I was still a newbie.
User contributions licensed under CC BY-SA 3.0