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



MySQL problem help - ManIsHere - 04.06.2016

hi.. why i get this error in my sql?
Код:
[19:23:17] Incoming connection: 127.0.0.1:62210 id: 0
[19:23:17] [join] Test_Name has joined the server (0:127.0.0.1)
[19:23:28] [MySQL] Query Error - (ErrorID: 1364) (Handle: 1)
[19:23:28] [MySQL] Check mysql_log.txt to review the query that threw the error.
[19:23:28] Dumping query from 2016/6/4 (19:23:28)

Description: Field 'id' doesn't have a default value (index 0). Query:


[19:23:28] INSERT INTO `accounts` (`RegiDate`, `LastLogin`, `Username`, `Key`) VALUES (NOW(), NOW(), 'Test_Name','24CF1A1E02ED12BCC5261147C131D271CD22D8C17AAFAC5ECDCC4A0FF91DAD086F8BBFED48D9284B2D54D7FBABFC8DB2C748F7E0402945FD38717690B3DF09B3')
[19:25:24] [part] Test_Name has left the server (0:2)



Re: MySQL problem help - Konstantinos - 04.06.2016

Set "id" as PRIMARY KEY with AUTO INCREMENT.


Re: MySQL problem help - ManIsHere - 04.06.2016

How to do it? i only have many .sql files. do i open .sql in mysql and then edit it?


Re: MySQL problem help - Konstantinos - 04.06.2016

Just run this query:
PHP код:
ALTER TABLE accounts MODIFY id INT AUTO_INCREMENT PRIMARY KEY



Re: MySQL problem help - ManIsHere - 04.06.2016

Where to run that quary?like open it in MYSQL then do it?


Re: MySQL problem help - ManIsHere - 04.06.2016

Hey i open .sql in MYSQL and seted primary key and now its working. i know a small mysql. so let me ask you,
if i want myself admin, i open .sql in mysql again and use:
Код:
update table accounts set  member = 1 where Username like 'Test_Name';



Re: MySQL problem help - Konstantinos - 04.06.2016

If being a "member" with value "1" makes you admin, then yes but remove table and replace like with =