Posts: 204
Threads: 28
Joined: Apr 2016
PHP код:
CMD:notice(playerid, params[])
{
if(isnull(params))
{
return SendClientMessage(playerid, COLOR_GREY, "/notice [text]")
}
if(pInfo[playerid][pNotice] == 1)
{
return SendClientMessage(playerid, COLOR_GREY, "You've used your notice. Type /deletenotice to delete it.")
}
else
{
pInfo[playerid][pNotice] = 1;
new string[127];
format(string, sizeof(string), "You've set your notice to %s", params)
SendClientMessage(playerid, COLOR_WHITE, string)
mysql_format(db_info, query, sizeof(query), "UPDATE players SET noticetext = %s WHERE pid = %i", params, GetPlayerDBId(playerid));
mysql_tquery(db_info, query, "", "");
}
return 1;
}
Now if i try it in game it says
PHP код:
Description: Unknown column 'Test' in 'field list' (index 0). Query: // TEST is the params the player putted at /notice
[22:58:47] UPDATE players SET noticetext = Test WHERE pid = 1
What's the problem :/?
Posts: 6,242
Threads: 8
Joined: Jun 2008
Well, it says the error. You may have used the output you got from /notice incorrectly (if you have just made this command and DB entry)
I'd suggest trying to re-import the sql if you are on a test box, but if this is a live server be very careful and simply make the field that it's missing.
When did it start happening, and what were you doing when it started.
Posts: 204
Threads: 28
Joined: Apr 2016
Код:
UPDATE players SET noticetext = %s WHERE pid = %i
I simply tested the command in game, so i did /notice test and it gave me that error, the field exists in table structure, i dont know whats wrong with it..
Posts: 204
Threads: 28
Joined: Apr 2016
Quote:
Originally Posted by X337
Код:
mysql_format(db_info, query, sizeof(query), "UPDATE players SET noticetext = '%e' WHERE pid = %i", params, GetPlayerDBId(playerid));
you have to enclose string with ' or "
and also, use %e instead of %s if the string can be inputted by player to escape string
|
Worked, thanks a lot. I thought about this but never tested, much appreciated.