MySQL saving everything apart from playerdata
#7

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
I haven't looked at the content, only at the picture.

But is pretty expected to not work.

You don't have default values for the field `ConnTime` (notice the default `None`) and so it cannot insert the line.


Either give default value using phpMyAdmin or expend your INSERT INTO query to insert default value to all fields.

I'd suggest to use phpMyAdmin > go to the table > tab "SQL" > press at the bottom "INSERT INTO", it will give you a ready query and just insert in the VALUES () appropriately.

You can also use this tab to test queries by inserting random expecting values.

Try to launch the query
INSERT INTO `playerdata` (`UserName`, `Password`, `IP`, `ConnTime`) VALUES('Ducati', SHA1('password'), '192.168.0.1', 0);

Another thing, I am unsure about the fields with "blank" as default (never tried or read about it), recommend to use 0 instead of blank and/or NULL.

To what I know, 0 is either faster or space efficient than NULL.
Thank you! Ive managed to get it working now, I set the 'None' fields to 0 which then allowed the query you provided to insert data into the table.

Then I edited the query in the script under the register dialog response from this:
Код:
format(query, sizeof(query), "INSERT INTO playerdata (UserName, Password, IP) VALUES('%s', SHA1('%s'), '%s')", PlayerInfo[playerid][pName], escpass, PIP);
To this: (the format from the query to told me to run in phpmyadmin)
Код:
format(query, sizeof(query), "INSERT INTO `playerdata` (`UserName`, `Password`, `IP`) VALUES('%s', SHA1('%s'), '%s')", PlayerInfo[playerid][pName], escpass, PIP);
(adding the symbols around the field names and table name and now its properly inserting to the table when a player registers)


I am very grateful for your help, i'd been struggling with this for so long!
Reply


Messages In This Thread
MySQL saving everything apart from playerdata - by Ducati - 20.02.2018, 20:50
Re: MySQL saving everything apart from playerdata - by X337 - 21.02.2018, 01:30
Re: MySQL saving everything apart from playerdata - by Ducati - 21.02.2018, 02:10
Re: MySQL saving everything apart from playerdata - by Kaperstone - 21.02.2018, 05:43
Re: MySQL saving everything apart from playerdata - by Ducati - 21.02.2018, 12:47
Re: MySQL saving everything apart from playerdata - by Kaperstone - 21.02.2018, 19:22
Re: MySQL saving everything apart from playerdata - by Ducati - 21.02.2018, 23:31

Forum Jump:


Users browsing this thread: 1 Guest(s)