select more than one row
Posted by: abanop nasem
Date: March 10, 2011 11:15PM

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=row;
}
}
mysql_free_result(res);
}

the way this function am using works so lets say i have like 1000 account and my query is

"select id,name,password from account"

my function will just get me the 1st row like if am using std::string acc[20];//array

so

id=acc[0];
name=acc[1];
password=acc[2];

but my question which i cant figure it out how i can select all the rows and use it?

Options: ReplyQuote


Subject
Views
Written By
Posted
select more than one row
1124
March 10, 2011 11:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.