MYSQL Problems..
#1

I already has this fields but MYSQL still show this error..
please help..

sorry for my bad English

Код:
new query[128];
	for(new i=0; i<=511; i++)
	{
	    mysql_format(mysql, query, sizeof(query), "SELECT `v_id` FROM `vehicles` WHERE `v_carid` = %d LIMIT 1", i);
		mysql_tquery(mysql, query, "loadVehicleData", "i", i);

		printf("%s", query);
	}
Код:
forward loadVehicleData(i);
public loadVehicleData(i)
{
	new str[32];
	new j=0;
	    vehicleData[i][vID] = cache_get_field_content_int(j, "v_id");

	    vehicleData[i][vModel] = cache_get_field_content_int(j, "v_model");
		vehicleData[i][vHealth] = cache_get_field_content_float(j, "v_health");

		vehicleData[i][vLocationX] = cache_get_field_content_float(j, "v_locationx");
		vehicleData[i][vLocationY] = cache_get_field_content_float(j, "v_locationy");
		vehicleData[i][vLocationZ] = cache_get_field_content_float(j, "v_locationz");

		vehicleData[i][vAngle] = cache_get_field_content_float(j, "v_angle");
		vehicleData[i][vModel] = cache_get_field_content_int(j, "v_model");

		vehicleData[i][vGas] = cache_get_field_content_int(j, "v_gas");
		vehicleData[i][vEngine] = cache_get_field_content_int(j, "v_engine");
		vehicleData[i][vDoors] = cache_get_field_content_int(j, "v_doors");
		vehicleData[i][vKeys] = cache_get_field_content_int(j, "v_keys");

		for(new b=0; b<sizeof(itemData); b++)
	    {
	        format(str, sizeof(str),"vitem_%d",b);
		    vehicleItem[i][b] = cache_get_field_content_int(j, str);
		}

		
	return 1;
}
Код:
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_model")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_health")
[19:32:54] [ERROR] cache_get_field_content_float - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_locationx")
[19:32:54] [ERROR] cache_get_field_content_float - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_locationy")
[19:32:54] [ERROR] cache_get_field_content_float - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_locationz")
[19:32:54] [ERROR] cache_get_field_content_float - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_angle")
[19:32:54] [ERROR] cache_get_field_content_float - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_model")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_gas")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_engine")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_doors")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("v_keys")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_0")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_1")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_2")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_3")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_4")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_5")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_6")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_7")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_8")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_9")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_10")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_11")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_12")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_13")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_14")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_15")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_16")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_17")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_18")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
[19:32:54] [WARNING] CMySQLResult::GetRowDataByName - field not found ("vitem_19")
[19:32:54] [ERROR] cache_get_field_content_int - invalid datatype
Reply
#2

You only select v_id field.
Код:
SELECT `v_id` FROM `vehicles` WHERE `v_carid` = %d LIMIT 1
Change it into:
Код:
SELECT * FROM `vehicles` WHERE `v_carid` = %d LIMIT 1
Reply
#3

I tried this code and mysql show another error to me

Quote:

[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_float - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_float - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_float - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_float - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_float - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:31] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype
[19:47:32] [ERROR] cache_get_field_content_int - invalid datatype

Reply
#4

Don't treat SQL like a dirty file system. You can fetch more than one row at a time. That's the point. Sending a separate query for each row is a massive waste of resources. Instead of looping over queries and fetching one result at a time, send one query and then loop over the results.
Reply
#5

And v_item%d is just wrong.

Check the tutorial here made by Vince: https://sampforum.blast.hk/showthread.php?tid=420363
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)