E
E
eellazy2016-08-31 13:20:58
PHP
eellazy, 2016-08-31 13:20:58

Why is the data in the database not being edited?

Hello! I just can’t understand why I don’t edit the data in the table through phpmy admin,
here is the table itself

CREATE TABLE IF NOT EXISTS `grey_csgo_gifts_list` (
`id` int(11) NOT NULL,
  `username` varchar(32) NOT NULL,
  `bd_model` varchar(50) NOT NULL,
  `wep_id` int(11) NOT NULL DEFAULT '0',
  `title` varchar(100) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;

Although the type is MyISAM. As far as I know everything should be edited
0426d243445d435db0b217dd826ea759.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis Vyachenkov, 2016-08-31
@vsyakiyjr

UPDATE `grey_csgo_gifts_list` SET `username` = 'pillar-03-edit' WHERE `grey_csgo_gifts_list`.`id` = 0; but each row must have a unique id (id = 1, id = 2, and so on) on which you will select. In order not to have problems with the architecture, create a primary key and a unique identifier.

A
Alexander, 2016-08-31
@zkelo

No primary key

S
Sergey c0re, 2019-10-27
@erge

the primary key, which should be id , is not specified as the primary key, it is 0 in all rows - why!?
it is necessary to make the id field the primary key, but first it is necessary either to delete all rows, or to register id incrementally in each row.
however, all the lines you have are identical and there is no way to distinguish them ...
so you can do this:

set @i = 0;

update `grey_csgo_gifts_list`
  set id = @i := @i + 1;

alter table `grey_csgo_gifts_list` modify `id` int(11) auto_increment primary key;

see example on dbfiddle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question