0
#include "includes.h"
MYSQL *con;
con=mysql_real_connect(con, server,user, password, database, 0, NULL, 0);
//mysql check:
	   int act;
	   int reb;
	   reb=mysql_query(con,"SELECT * FROM cq_rebirth");
	   act=mysql_query(con,"SELECT * FROM cq_action");
	   if(act !=0 || reb !=0){
		   cout << mysql_error(con);
		   return 1;
	   }

Error: Commands out of sync; you can't run this command now

i wanna select like more than 10 tables lol so how can i do it :)

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Ancient Dragon
0

You can't execute another query, without freeing the last result.
So you need to do one query, use the results, free the results, do the next query

etc.

-2

You can't execute another query, without freeing the last result.
So you need to do one query, use the results, free the results, do the next query

etc.

that's gay is there aonther way?

0

You could do it all in one query SELECT cq_rebirth.*, cq_action.* from cq_rebirth cq_action But that may not work if there are column names that occur in two or more tables. It might also produce a very very huge result set with many NULL columns for any given row. It would be far better to execute the queries individually as previously suggested.

You could write a function that executes a query and puts the results into a vector that can be used by other parts of the program.

0

You could do it all in one query SELECT cq_rebirth.*, cq_action.* from cq_rebirth cq_action But that may not work if there are column names that occur in two or more tables. It might also produce a very very huge result set with many NULL columns for any given row. It would be far better to execute the queries individually as previously suggested.

You could write a function that executes a query and puts the results into a vector that can be used by other parts of the program.

can u give me a simple code showing me how can i do it ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.