#1

Well, I'm getting this error. I wanted to edit account's properties like level, money etc. but I can't due to this error. Can you fix it?
Код:
Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.
and this is MYSQL's code.
Код:
  CREATE TABLE IF NOT EXISTS vehicles(id INT(128), model INT(128), X VARCHAR(128), Y VARCHAR(128), Z VARCHAR(128)
, A VARCHAR(128), col1 INT(128), col2 INT(128), owned INT(10), owner VARCHAR(128), mod1 INT(128) NOT NULL DEFAULT '-1', mod2 INT(128) NOT NULL DEFAULT '-1', mod3 INT(128) NOT NULL DEFAULT '-1', mod4 INT(128) NOT NULL DEFAULT '-1', mod5 INT(128) NOT NULL DEFAULT '-1', mod6 INT(128) NOT NULL DEFAULT '-1', mod7 INT(128) NOT NULL DEFAULT '-1', mod8 INT(128) NOT NULL DEFAULT '-1', mod9 INT(128) NOT NULL DEFAULT '-1', mod10 INT(128) NOT NULL DEFAULT '-1', mod11 INT(128) NOT NULL DEFAULT '-1'
, mod12 INT(128) NOT NULL DEFAULT '-1', mod13 INT(128) NOT NULL DEFAULT '-1' , mod14 INT(128) NOT NULL DEFAULT '-1', mod15 INT(128) NOT NULL DEFAULT '-1'
, mod16 INT(128) NOT NULL DEFAULT '-1', mod17 INT(128) NOT NULL DEFAULT '-1', paintjob INT(10), slot INT(10) NOT NULL DEFAULT '0', security INT(128), price INT(128), sprice INT(128), buyable INT(10), vName VARCHAR(128)
, Engine INT(10) NOT NULL DEFAULT '1', Engines INT(10) NOT NULL DEFAULT '0') ENGINE = InnoDB DEFAULT CHARSET = latin1 AUTO_INCREMENT = 1;
Код:
  CREATE TABLE IF NOT EXISTS houses(ID INT(128), HX VARCHAR(128), HY VARCHAR(128), HZ VARCHAR(128), IX VARCHAR(128) NOT NULL DEFAULT '0', IY VARCHAR(128) NOT NULL DEFAULT '0', IZ VARCHAR(128) NOT NULL DEFAULT '0', Price INT(128), SPrice INT(128), Interior INT(10), World INT(128), Locked INT(10), Owned INT(128), Owner VARCHAR(128), Make INT(10) ) ENGINE = InnoDB DEFAULT CHARSET = latin1 AUTO_INCREMENT = 1;
Reply
#2

Your query is incorrect.


It should be something like:

Код:
CREATE TABLE `vehicles` (
  `id` int(11) NOT NULL, 
  `model` int(11) NOT NULL,
  `X` float NOT NULL DEFAULT '0.0',
  `Y` float NOT NULL DEFAULT '0.0',
  `Z` float NOT NULL DEFAULT '0.0',
  `A` float NOT NULL DEFAULT '0.0',
  `col1` int(5) NOT NULL DEFAULT '0',
  `col2` int(5) NOT NULL DEFAULT '0',
  `owned` int(11) NOT NULL,
  `owner` varchar(32) NOT NULL,
  `mod1` int(9) NOT NULL DEFAULT '0',
  `mod2` int(9) NOT NULL DEFAULT '0',
  `mod3` int(9) NOT NULL DEFAULT '0',
  `mod4` int(9) NOT NULL DEFAULT '0',
  `mod5` int(9) NOT NULL DEFAULT '0',
  `mod6` int(9) NOT NULL DEFAULT '0',
  `mod7` int(9) NOT NULL DEFAULT '0',
  `mod8` int(9) NOT NULL DEFAULT '0',
  `mod9` int(9) NOT NULL DEFAULT '0',
  `mod10` int(9) NOT NULL DEFAULT '0',
  `mod11` int(9) NOT NULL DEFAULT '0',
  `mod12` int(9) NOT NULL DEFAULT '0',
  `mod13` int(9) NOT NULL DEFAULT '0',
  `mod14` int(9) NOT NULL DEFAULT '0',
  `mod15` int(9) NOT NULL DEFAULT '0',
  `mod16` int(9) NOT NULL DEFAULT '0',
  `mod17` int(9) NOT NULL DEFAULT '0',
  `paintjob` int(9) NOT NULL DEFAULT '-1',
  `slot` tinyint(2) NOT NULL DEFAULT '0', 
  `security` int(9) NOT NULL,
  `price` int(9) NOT NULL,
  `sprice` int(9) NOT NULL,
  `buyable` tinyint(2) NOT NULL
  `vName` varchar(100) NOT NULL,
  `Engine` tinyint(2) NOT NULL DEFAULT '1',
  `Engines` tinyint(2) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT = 1;
Reply
#3

Quote:
Originally Posted by Dennis12
Посмотреть сообщение
Your query is incorrect.
If it was incorrect you would find a error in mysql log. Log tells something different than "wrong syntax".
Your code may look more tidy, but that doesn't mean it is correct only for that.

RayanIbrahim post how you select the data please
Reply
#4

I posted the same way I posted here
Reply
#5

3 threads for the same issue.

https://sampforum.blast.hk/showthread.php?tid=659322
https://stackoverflow.com/questions/...-a-mysql-table

What Dennis12 pointed out is floating-point numbers that are set as `VARCHAR` when mysql provides the datatype (both float and double). You need to design your database structure more effectively.

Why is there everywhere 128?
Why are there no unique keys?
Most importantly, why 17 columns for components that a vehicle may not even have?
Reply
#6

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
3 threads for the same issue.

https://sampforum.blast.hk/showthread.php?tid=659322
https://stackoverflow.com/questions/...-a-mysql-table

What Dennis12 pointed out is floating-point numbers that are set as `VARCHAR` when mysql provides the datatype (both float and double). You need to design your database structure more effectively.

Why is there everywhere 128?
Why are there no unique keys?
Most importantly, why 17 columns for components that a vehicle may not even have?
A mistake commonly found in most gamemodes. Actually, in most databases.
Instead of using just a VARCHAR ..


With, the code I posted above has to go to create the table without problems (it was tested).
Reply
#7

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
3 threads for the same issue.

https://sampforum.blast.hk/showthread.php?tid=659322
https://stackoverflow.com/questions/...-a-mysql-table

What Dennis12 pointed out is floating-point numbers that are set as `VARCHAR` when mysql provides the datatype (both float and double). You need to design your database structure more effectively.

Why is there everywhere 128?
Why are there no unique keys?
Most importantly, why 17 columns for components that a vehicle may not even have?
Can you help me fix it?
Reply
#8

Quote:
Originally Posted by RayanIbrahim
Посмотреть сообщение
Can you help me fix it?
I provided 2 methods to set primary key for a table, one with the phpMyAdmin interface and one with a query. Did you try any of them?

The column you need to set as PK is `id` (for `vehicles`) and `ID` (for `houses`).
Reply
#9

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
I provided 2 methods to set primary key for a table, one with the phpMyAdmin interface and one with a query. Did you try any of them?

The column you need to set as PK is `id` (for `vehicles`) and `ID` (for `houses`).
How??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)