SA-MP Forums Archive
MySQL - 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 (/showthread.php?tid=621051)



MySQL - Micko123 - 06.11.2016

Okay so I am new at MySQL and I am following one tutorial for log/reg sys.
I found this
PHP код:
UPDATE `playersSET `deaths` = %d WHERE `id` = %d LIMIT 1 
I understand most of this but what I don't understand is this
PHP код:
WHERE `id` = %d LIMIT 1 
Can someone explain me this limit 1??

Thx in advance


Re: MySQL - AjaxM - 06.11.2016

It means that we need only 1 result to be shown.


Re: MySQL - justice96 - 06.11.2016

As once it's found one result, it'll stops.


Re: MySQL - Micko123 - 06.11.2016

Thanks guys


Re: MySQL - Vince - 06.11.2016

It's pretty useless in this case since - assuming that "id" is the primary key - there will always be only one result anyway.


Re: MySQL - Micko123 - 06.11.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
It's pretty useless in this case since - assuming that "id" is the primary key - there will always be only one result anyway.
Yeah but you'll never know xD


Re: MySQL - Vince - 06.11.2016

Um yeah, you do know. That's the point of the primary key: being unique in the table. It's impossible to insert a duplicate key; MySQL simply won't let you.