[MySQL] samp-server quits when you run query
#1

Code:
stock CarregarVeiculos()
{
	for(new b = 0; b < MAX_VEHICLES; b++) {
	new string[256];
 	format(string, 256, "SELECT * FROM carros WHERE id = %d", b);
 	mysql_query("SELECT * FROM carros WHERE id = 2");
	mysql_store_result();
	new rows = mysql_num_rows();
	if(rows == 1) {
	  new dono[256];
	  new Float:x, Float:y, Float:z, Float:angulo;
	 	new modelo, gasolina;
	 	format(string, 256,"SELECT dono FROM `carros` WHERE id = '%d' LIMIT 1", b);
		mysql_query(string);
		mysql_store_result();
		mysql_fetch_field_row(dono, "dono");
 		format(string, 256,"SELECT p_x FROM `carros` WHERE id = '%d' LIMIT 1", b);
		mysql_query(string);
		mysql_fetch_float(x);
 		format(string, 256,"SELECT p_y FROM `carros` WHERE id = '%d' LIMIT 1", b);
		mysql_query(string);
		mysql_store_result();
		mysql_fetch_float(y);
		format(string, 256,"SELECT p_z FROM `carros` WHERE id = '%d' LIMIT 1", b);
		mysql_query(string);
		mysql_store_result();
		mysql_fetch_float(z);
		format(string, 256,"SELECT angulo FROM `carros` WHERE id = '%d' LIMIT 1", b);
		mysql_query(string);
		mysql_store_result();
		mysql_fetch_float(angulo);
		format(string, 256,"SELECT modelo FROM `carros` WHERE id = '%d' LIMIT 1", b);
		mysql_query(string);
		mysql_store_result();
		modelo = mysql_fetch_int();
		format(string, 256,"SELECT gasolina FROM `carros` WHERE id = '%d' LIMIT 1", 2);
		mysql_query(string);
		mysql_store_result();
		gasolina = mysql_fetch_int();
		printf("Dono = %s", dono);
		printf("X = %f", x);
		printf("Modelo = %d", gasolina);
		}
	}
	return 1;
}
This code and to load my cars that are in the database. However when I run this code the samp-server closes. And when I mention it's the query is normal.

What can this be?
Sorry my bad english. I am brazilian
Reply


Messages In This Thread
[MySQL] samp-server quits when you run query - by dioguitosbr - 09.11.2009, 18:03
Re: [MySQL] samp-server quits when you run query - by Marcel - 09.11.2009, 18:55
Re: [MySQL] samp-server quits when you run query - by Streetplaya - 09.11.2009, 19:03

Forum Jump:


Users browsing this thread: 1 Guest(s)