i have mysql problem
#1

Quote:

strcat(string, "UPDATE `players` SET `p_ammo` = %d, `p_reload` = %d, `p_weapontype` = %d, `p_posx` = %f, `p_posy` = %f, `p_posz` = %f, `p_skin` = %d, `p_interior` = %d, `p_vw` = %d, `p_health` = %f, `p_race` = %d, `p_gender` = %d, `p_group` = %d,");
strcat(string, "`p_dise` = %d, `p_quest` = %d, `p_bleeding` = %d, `p_hunger` = %d, `p_thirst` = %d, `p_keys` = %d, `p_bullet` = %d, `p_nicolasmission1` = %d, `p_nicolasmission2` = %d, `p_davemission1` = %d, `p_davemission2` = %d, `p_gas` = %d, `p_mail` = '%s' WHERE `p_id` = %d");

format(query, sizeof(query), string
, playerData[playerid][pAmmo]
, playerData[playerid][pReload]
, playerData[playerid][pWeaponType]
, playerData[playerid][pSaveX]
, playerData[playerid][pSaveY]
, playerData[playerid][pSaveZ]
, playerData[playerid][pSkin]
, playerData[playerid][pInterior]
, playerData[playerid][pVw]
, playerData[playerid][pHealth]
, playerData[playerid][pRace]
, playerData[playerid][pGender]
, playerData[playerid][pGroup]
, playerData[playerid][pDise]
, playerData[playerid][pQuest]
, playerData[playerid][pBleeding]
, playerData[playerid][pHunger]
, playerData[playerid][pThirst]
, playerData[playerid][pKeys]
, playerData[playerid][pBullet]
, playerData[playerid][pNicolasMission1]
, playerData[playerid][pNicolasMission2]
, playerData[playerid][pDaveMission1]
, playerData[playerid][pDaveMission2]
, playerData[playerid][pGas]
);

I have this error
[10:13:41 01/10/17] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 (Query: "UPDATE `players` SET `p_ammo` = 0, `p_reload` = 0, `p_weapontype` = 0, `p_posx` = 325.627593, `p_posy` = 307.032440, `p_posz` = 999.148437, `p_skin` = 29, `p_interior` = 5, `p_vw` = 1, `p_health` = 100.000000, `p_race` = 0, `p_gender` = 0, `p_group` = 0,`p_dise` = 0, `p_quest` = 0, `p_bleeding` = 0, `p_hunger` = 0, `p_thirst` = 0, `p_keys` = 0, `p_bullet` = 0, `p_nicolasmission1` = 0, `p_nicolasmission2` = 0, `p_davemission1` = 0, `p_davemission2` = 0, `p_gas` = 0, `p_mail` = '' WHERE `p_id` = ")

please help me TT


sorry for my bad English
Reply
#2

Well, the error's getting called because you forgot to include the last two variables the query is expecting.

pawn Код:
, playerData[playerid][pDaveMission2]
, playerData[playerid][pGas]
, playerData[playerid][pMail] //p_mail variable
, playerData[playerid][pID] //p_id variable
);

//You should get what I mean, just replace those two with however you've set them up.
Reply
#3

You've not given the data to be entered for 'p_mail' and it expects an ID to locate the row that has to be updated. You've given data only upto 'p_gas'. I'm not sure if there are any other errors, it's a long query and I didn't spend much time reading it.

EDIT : Late.
Reply
#4

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
You've not given the data to be entered for 'p_mail' and it expects an ID to locate the row that has to be updated. You've given data only upto 'p_gas'. I'm not sure if there are any other errors, it's a long query and I didn't spend much time reading it.

EDIT : Late.
Thank you ! I have another problem ...

Код:
[11:27:39 01/10/17] [WARNING] CMySQLHandle::Create - connection already exists
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_ammo") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_reload") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_weapontype") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_posx") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_float - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_posy") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_float - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_posz") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_float - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_skin") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_interior") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_vw") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_health") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_float - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_tutorial") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_race") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_gender") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_group") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_dise") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_quest") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_bleeding") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_hunger") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_thirst") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_keys") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_bullet") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_weaponsecondary") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_nicolasmission1") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_nicolasmission2") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_davemission1") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_davemission2") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
[11:28:03 01/10/17] [WARNING] CMySQLResult::GetRowDataByName - field not found ("p_gas") (Query: "SELECT * FROM `players` WHERE `p_name` = 'Prince_Jess' LIMIT 1")
[11:28:03 01/10/17] [ERROR] cache_get_field_content_int - invalid datatype
Код:
in dialogresponse
case DIALOG_LOG :
		{
		    new query[1024], name[MAX_PLAYER_NAME];
       		GetPlayerName(playerid, name, sizeof(name));
	       	
		    format(str3, sizeof(str3),"{FFFFFF}Welcome to {FFFF82}%s!\n{FFFFFF}플레이 하기 위해 당신의 계정을 아래 입력하시길 바랍니다.\n아래 당신이 사용하던 패스워드를 입력하십시오.",playerName[playerid]);
		    if(response)
		    {
		        if(!strlen(inputtext))
		            return ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "로그인", str3, "생성","");

		        if(!strcmp(inputtext, playerData[playerid][password], false))
				{
				    mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `p_name` = '%e' LIMIT 1", name);
                	mysql_tquery(mysql, query, "onAccountLoad", "i", playerid);
				}
				else
					ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "로그인", str3, "생성","");
			}
		}
Код:
forward onAccountLoad(playerid);
public onAccountLoad(playerid)
{
    new str[32];
    
	playerData[playerid][pAmmo] = cache_get_field_content_int(0, "p_ammo");
	playerData[playerid][pReload] = cache_get_field_content_int(0, "p_reload");
	playerData[playerid][pWeaponType] = cache_get_field_content_int(0, "p_weapontype");
	playerData[playerid][pSaveX] = cache_get_field_content_float(0, "p_posx");
	playerData[playerid][pSaveY] = cache_get_field_content_float(0, "p_posy");
	playerData[playerid][pSaveZ] = cache_get_field_content_float(0, "p_posz");
	playerData[playerid][pSkin] = cache_get_field_content_int(0, "p_skin");
	playerData[playerid][pInterior] = cache_get_field_content_int(0, "p_interior");
	playerData[playerid][pVw] = cache_get_field_content_int(0, "p_vw");
	playerData[playerid][pHealth] = cache_get_field_content_float(0, "p_health");
	playerData[playerid][pTutorial] = cache_get_field_content_int(0, "p_tutorial");
	playerData[playerid][pRace] = cache_get_field_content_int(0, "p_race");
	playerData[playerid][pGender] = cache_get_field_content_int(0, "p_gender");
	playerData[playerid][pGroup] = cache_get_field_content_int(0, "p_group");
	playerData[playerid][pDise] = cache_get_field_content_int(0, "p_dise");
	playerData[playerid][pQuest] = cache_get_field_content_int(0, "p_quest");
	playerData[playerid][pBleeding] = cache_get_field_content_int(0, "p_bleeding");
	playerData[playerid][pHunger] = cache_get_field_content_int(0, "p_hunger");
	playerData[playerid][pThirst] = cache_get_field_content_int(0, "p_thirst");
	playerData[playerid][pKeys] = cache_get_field_content_int(0, "p_keys");
	playerData[playerid][pBullet] = cache_get_field_content_int(0, "p_bullet");
	playerData[playerid][pWeaponSecondary] = cache_get_field_content_int(0, "p_weaponsecondary");
	playerData[playerid][pNicolasMission1] = cache_get_field_content_int(0, "p_nicolasmission1");
	playerData[playerid][pNicolasMission2] = cache_get_field_content_int(0, "p_nicolasmission2");
	playerData[playerid][pDaveMission1] = cache_get_field_content_int(0, "p_davemission1");
	playerData[playerid][pDaveMission2] = cache_get_field_content_int(0, "p_davemission2");
	playerData[playerid][pGas] = cache_get_field_content_int(0, "p_gas");
	cache_get_field_content(0, "p_mail", playerData[playerid][mail], mysql, 64);
	
	for(new i=0; i<sizeof(itemData); i++)
    {
        format(str, sizeof(str),"item_%d",i);
	    playerItem[playerid][i] = cache_get_field_content_int(0, str);
	}

	loginTextDraw(playerid, false);
	TogglePlayerSpectating(playerid, false);

	fadeScreen(playerid, true);

	if(playerData[playerid][pTutorial] == 1)
		showConditionTextDraw(playerid);

	login[playerid] = true;
	
    return true;
}
Reply
#5

"CMySQLResult::GetRowDataByName - field not found"

u sure its the correct table?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)