• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Linux About Error in Console - Mysql!

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hi!

I dont know to explain better.. But when a player create the char from the name containing dash or quotes ( - or ' ) , i find thats errors:


Na'vi has logged in.
mysql_real_query(): UPDATE `players` SET `ip` = '179.235.163.56' WHERE name = 'Na'vi'; - MYSQL ERROR: 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 'vi'' at line 1 (1064)


mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'5100','1'),(2,'666','1410212354'),(2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)

And this...

mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'5100','1'),(2,'666','1410212354'),(2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}') - MYSQL ERROR: Duplicate entry


mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'5100','1'),(2,'666','1410212801'),(2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'5100','1'),(2,'666','1410212801'),(2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'5100','1'),(2,'666','1410212801'),(2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
Error while saving player: GOD The Swag.

GOD The Swag has logged out.
mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'5100','1'),(2,'666','1410213997'),(2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'5100','1'),(2,'666','1410213997'),(2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'5100','1'),(2,'666','1410213997'),(2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
Error while saving player: GOD The Swag.




Sorry, i no have idea to explain it!
Help! Tks!
 
Last edited:
Well, you're vulnerable to a lot of things.

First of all:

Code:
mysql_real_query(): UPDATE `players` SET `ip` = '179.235.163.56' WHERE name = 'Na'vi'; - MYSQL ERROR: 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 'vi'' at line 1 (1064)

The name of the player is Na'vi, and you put it like 'Na'vi' at your database, so there's an error since 'Na' is the player name for your database, and there's a strange element vi'; right after that shouldn't be there.

As for the second error, I don't know exactly why, but can you see if you have a key called player_id_2 in player_storage?
 
Well, you're vulnerable to a lot of things.

First of all:

Code:
mysql_real_query(): UPDATE `players` SET `ip` = '179.235.163.56' WHERE name = 'Na'vi'; - MYSQL ERROR: 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 'vi'' at line 1 (1064)

The name of the player is Na'vi, and you put it like 'Na'vi' at your database, so there's an error since 'Na' is the player name for your database, and there's a strange element vi'; right after that shouldn't be there.

As for the second error, I don't know exactly why, but can you see if you have a key called player_id_2 in player_storage?

I've changed the name of player Na'vi to Navi and that error are fixed. But, how i do to players dont create a char if name containing dash or quotes? Im using just Acc manager.

N the second error ive check and ive the storage in db, like that:

Player ID 2:
Value: 20{["subType"] = 1, ["type"] = 1}
Value: 1410231377
Value: 1

Why this happened?
 
Ok, I think I got your error. I'm no master at mysql, but from my knowledge you can only do this:
Code:
INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}');

the others you need to do a new query like this:
Code:
INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}')
INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'5100','1');
INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'666','1410213997');

about the acc manager, what distro do you use?
 
Ok, I think I got your error. I'm no master at mysql, but from my knowledge you can only do this:
Code:
INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}');

the others you need to do a new query like this:
Code:
INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'banConfig','{[\"subType\"] = 9, [\"type\"] = 2}')
INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'5100','1');
INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'666','1410213997');

about the acc manager, what distro do you use?

I need turn off my server to execute that commands in my db?

EDIT:
I execute the first and ive this:

#1062 - Duplicate entry '2-0' for key 'player_id_2'
INSERT INTO `player_storage` ( `player_id` , `key` , `value` )
VALUES ( 2, '0', '{[\"subType\"] = 1, [\"type\"] = 1}' ) ;
 
That's really strange, do you have a schema of your db? (The thing that create just the tables and so on, without data inside)
 
You don't need to turn off your server. Can you tell me what's the data structure you used for your columns in 'player_storage'?

I was trying here to reproduce your error, but I can't ):
 
How i do to fix this bro?!

mysql_real_query(): UPDATE `players` SET `ip` = '200.140.154.73' WHERE name = 'El'cabrito'; - MYSQL ERROR: 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 'cabrito'' at line 1 (1064)
 
It's the same thing as with Na'vi, you can't have a player with ' in it's name.


about player_storage:

do a
Code:
 drop table player_storage
and then do this:

Code:
CREATE TABLE IF NOT EXISTS `player_storage` (
  `player_id` int(11) NOT NULL DEFAULT '0',
  `key` int(10) unsigned NOT NULL DEFAULT '0',
  `value` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`player_id` , `key`),
  FOREIGN KEY (`player_id`)
  REFERENCES `players` (`id`)
  ON DELETE CASCADE
)  ENGINE=InnoDB;
 
I cant drop the table of player_storage.. All skills of players are fixed in. If i reset, all Players will earn skill again when logging.. So would current skill + new storage.

So, if i can't have a player with ' in it's name, okay. How i do to players dont create the name with dashs and quotes?!?!?!?!?!?
 
Last edited:
mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'45814','1411160830'),(2,'5100','1'),(2,'666','1411415753'),(2,'banConfig','{[\"subType\"] = 1, [\"type\"] = 1}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'45814','1411160830'),(2,'5100','1'),(2,'666','1411415753'),(2,'banConfig','{[\"subType\"] = 1, [\"type\"] = 1}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
mysql_real_query(): INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}'),(2,'45814','1411160830'),(2,'5100','1'),(2,'666','1411415753'),(2,'banConfig','{[\"subType\"] = 1, [\"type\"] = 1}') - MYSQL ERROR: Duplicate entry '2-0' for key 'player_id_2' (1062)
Error while saving player: GOD The Swag.


WTF?
 
Ok, found your error.
Keys are primary at your database, so you can't have two keys of the same value being inserted into player_storage.

(2,'0','{[\"subType\"] = 1, [\"type\"] = 1}') will go to key '0', but (2,'banConfig','{[\"subType\"] = 1, [\"type\"] = 1}') will too, so you're receiving an duplicate entry error.

Try not to use strings as keys or values as they'll be inserted as 0.

Here, see how it's inserted at the DB?

Code:
mysql> select * from player_storage;
Empty set (0,00 sec)

mysql> INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'0','{[\"subType\"] = 1, [\"type\"] = 1}');
Query OK, 1 row affected, 1 warning (0,03 sec)

mysql> select * from player_storage; 
+-----------+-----+-------+
| player_id | key | value |
+-----------+-----+-------+
|  2 |  0 |  0 |
+-----------+-----+-------+
1 row in set (0,00 sec)

mysql> INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'banConfig','{[\"subType\"] = 1, [\"type\"] = 1}');
ERROR 1062 (23000): Duplicate entry '2-0' for key 'PRIMARY'
mysql> INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (2,'1','{[\"subType\"] = 1, [\"type\"] = 1}');
Query OK, 1 row affected, 1 warning (0,04 sec)

mysql> select * from player_storage;
+-----------+-----+-------+
| player_id | key | value |
+-----------+-----+-------+
|  2 |  0 |  0 |
|  2 |  1 |  0 |
+-----------+-----+-------+
2 rows in set (0,00 sec)
 
Back
Top