#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 :)

Recommended Answers

All 5 Replies

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.

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?

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.

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 ?

Here are some links you will need to study.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.