MySQL register bug/error
#1

Hello SA-MP Forums, i got a small issue with my script which is MySQL based.

So when i try to register an account i get this weird message (example):

[19/04/2013 11:31:50] errorid: 1364 | error: Field 'ContractBy' doesn't have a default value | callback: OnQueryFinish | query: INSERT INTO players (Username, Password) VALUES('ACAB', '8513C69D070A008DF008AEF8624ED24AFC81B170D242FAF5F AFE853D4FE9BF8AA7BADFB0FD045D7B350B19FBF8EF6B2A51F 17A07A1F6819ABC9BA5CE43324244') | connection handle: 1 | resultid: 4 | extraid: 0

I've already checked the script about fixing this i've been searching for like 2 hours lol

Anyways, the field "ContractBy" as the error says it has this value set (at the DB & at the script)

NOTE: Registered accounts work perfect when they Login. Register is the issue :/

Thanks in advance!
Reply
#2

In your SQL tables, the field 'ContractBy' doesn't have a default value.. You need to set it a default value of 0 or 1, or etc.. If you gave me a picture of your database structure I can help.
Reply
#3

Sure there you go: http://pastebin.com/wuyC2k5E
Reply
#4

I see your issue, in your SQL you have this

pawn Код:
`TicketTime` int(4) NOT NULL DEFAULT '0',
  `HeadValue` int(11) NOT NULL DEFAULT '0',
  `ContractBy` varchar(24) NOT NULL,
  `ContractDetail` varchar(64) NOT NULL,
  `Bombs` int(4) NOT NULL DEFAULT '0',
  `CHits` int(11) NOT NULL DEFAULT '0',
  `FHits` int(11) NOT NULL DEFAULT '0',
There is no default value for ContractDetail and Contract by

pawn Код:
`TicketTime` int(4) NOT NULL DEFAULT '0',
  `HeadValue` int(11) NOT NULL DEFAULT '0',
  `ContractBy` varchar(24) NOT NULL DEFAULT '0',
  `ContractDetail` varchar(64) NOT NULL DEFAULT '0',
  `Bombs` int(4) NOT NULL DEFAULT '0',
  `CHits` int(11) NOT NULL DEFAULT '0',
  `FHits` int(11) NOT NULL DEFAULT '0',
Please re-look at your SQL and make sure you have default values.
Reply
#5

The pastebin i've sent you is a dump from the working users sql table. Also by default ContractBy is set to "Nobody" same goes with ContractDetail.

When i dump the working table it's exactly as the pastebin link i've posted above.

Screenshot of table: http://i49.tinypic.com/21b42vl.png
Reply
#6

IT says nobody, but it doesn't have a default value... Set the default value... as 0

0 = Nobody
Reply
#7

EDIT: FIXED!
Reply
#8

Lol, was just going to respond to say make a default value xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)