SA-MP Forums Archive
Is there anything wrong with that query? - 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: Is there anything wrong with that query? (/showthread.php?tid=618152)



Is there anything wrong with that query? - ranme15 - 01.10.2016

Код:
	mysql_format(SQL, query, sizeof query, "UPDATE `users` SET `ip` = %s, `money` = %d, `admin` = %d, `vip` = %d, `vipdate` = %d, `world` = %d WHERE `id` = %d LIMIT 1", pInfo[playerid][IP], pInfo[playerid][Money], pInfo[playerid][Admin], pInfo[playerid][VIP], pInfo[playerid][VIPDate], pInfo[playerid][World], pInfo[playerid][ID]);
	mysql_tquery(SQL, query);
debug:
Код:
UPDATE `users` SET `ip` = 127.0.0.1, `money` = 0, `admin` = 0, `vip` = 0, `vipdate` = 0, `world` = 1 WHERE `id` = 17 LIMIT 1


It sets everything fine but world stays '0' for some reason.
Help?

EDIT: Noticed that error now. Ideas?
Код:
[plugins/mysql] error #1064 while executing query "UPDATE `users` SET `ip` = 127.0.0.1, `money` = 0, `admin` = 0, `vip` = 0, `vipdate` = 0, `world` = 1 WHERE `id` = 17 LIMIT 1": You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.0.1, `money` = 0, `admin` = 0, `vip` = 0, `vipdate` = 0, `world` = 1 WHERE `id`' at line 1



Re: Is there anything wrong with that query? - Banditul18 - 01.10.2016

SET `ip` = '%s' String must have apostrohes, and check if the query size is big enought
srry for poor english.

Edit: Now i realise the debug line, its big enought.


Re: Is there anything wrong with that query? - ranme15 - 01.10.2016

Quote:
Originally Posted by Banditul18
Посмотреть сообщение
SET `ip` = '%s' String must have apostrohes, and check if the query size is big enought
srry for poor english.

Edit: Now i realise the debug line, its big enought.
Thanks for the attempt though.
Any other ideas? Does anyone see what I don't?


Re: Is there anything wrong with that query? - SickAttack - 01.10.2016

Wrap %s with single quotes (') - ip field.


Re: Is there anything wrong with that query? - ranme15 - 02.10.2016

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Wrap %s with single quotes (') - ip field.
That works. Thanks mate