void BaseMySQL::QueryArray(char *InQuery,std::string outResult[])
{
query_state = mysql_query(con, InQuery);
if (query_state !=0) {
printf("%s",mysql_error(con));
}
res = mysql_store_result(con);
m_fields = (WORD)mysql_num_fields(res);
while((row = mysql_fetch_row(res))!= NULL) {
for(int i = 0; i < m_fields; i++)
{
outResult[i]=row[i];
}
}
mysql_free_result(res);
}
这个函数使用的方式是有效的,所以可以说我有 1000 个帐户,我的查询是
“从帐户中选择 ID、姓名、密码”
我的函数只会让我获得第一行,就像我正在使用一样 std::string acc[20];//array
所以
id=acc[0];
name=acc[1];
password=acc[2];
但是我的问题是我无法弄清楚如何选择所有行并使用它?