SA-MP Forums Archive
MySQL "unknown column" but its their! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL "unknown column" but its their! (/showthread.php?tid=656717)



MySQL "unknown column" but its their! - NinjaChicken - 22.07.2018

Код:
						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


Re: MySQL "unknown column" but its their! - Banditul18 - 22.07.2018

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


Re: MySQL "unknown column" but its their! - NinjaChicken - 22.07.2018

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


Re: MySQL "unknown column" but its their! - grymtn - 22.07.2018

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.
Код:
'



Re: MySQL "unknown column" but its their! - GTLS - 23.07.2018

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.