MySQL "unknown column" but its their!
#1

Код:
						new CasefileName[MAX_PLAYER_NAME], CasefileInfo[256];
						szMiscArray[0] = 0;

						GetPVarString(playerid, "CasefileName", CasefileName, sizeof(CasefileName));
						GetPVarString(playerid, "CasefileInfo", CasefileInfo, sizeof(CasefileInfo));

						mysql_format(MainPipeline, szMiscArray, sizeof(szMiscArray), "INSERT INTO `casefiles` (`suspect`, `issuer`, `information`, `group`, `active`) VALUES (`%s`, `%s`, `%s`, `%d`, `1`)", CasefileName, GetPlayerNameEx(playerid), CasefileInfo, PlayerInfo[playerid][pMember]);
						mysql_tquery(MainPipeline, szMiscArray, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);


Код:
[08:35:49] [zcmd] [Eatlag]: /casefile
[08:35:51] [MySQL] Query Error - (ErrorID: 1054)
[08:35:51] [MySQL] Check mysql_log.txt to review the query that threw the error.
[08:35:51] Dumping query from 2018/7/22 (8:35:51)

Description: Unknown column 'Eatlag' in 'field list' (index 0). Query:


[08:35:51] INSERT INTO `casefiles` (`suspect`, `issuer`, `information`, `group`, `active`) VALUES (`Eatlag`, `Eatlag`, `jjjgjgjjgjg`, `29`, `1`)
WTF IS GOING ON
Reply
#2

PHP код:
    mysql_format(MainPipelineszMiscArraysizeof(szMiscArray), "INSERT INTO `casefiles` (`suspect`, `issuer`, `information`, `group`, `active`) VALUES ('%s', '%s', '%s', %d, 1)"CasefileNameGetPlayerNameEx(playerid), CasefileInfoPlayerInfo[playerid][pMember]); 
Dont use backticks instead of single quote. Backticks are used for fields not for values
Reply
#3

Hmm alright, i dont follow you im sorry, have you go any more examples?
Reply
#4

Quote:
Originally Posted by NinjaChicken
Посмотреть сообщение
Hmm alright, i dont follow you im sorry, have you go any more examples?
Just use the right one and you will be good to go.
Код:
`
The one above is a back tick. The one below is single quotion mark.
Код:
'
Reply
#5

What he meant is, the single tick that is "`" is used to denote fields (or columns) so use Single quote, that is, "'" to denote string data.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)