I do this in phpMyAdmin, but the data is not deleted:

DELETE FROM images_big WHERE filename = '22.jpg' 

How to make the data deleted in a particular place?

enter image description here

  • 2
    SQL allows you to operate on strings. You can only delete the entire entry. You need to either update the contents of the field yourself using update. Or, much better, alter the database structure and list the files into a separate table, so that each file is a separate entry. And the use of any lists separated by commas, as you now have a lot of problems, because SQL is simply not designed to work with such data - Mike
  • I would not generalize, but on the whole it is true - and so, there are exceptions. - Timur Musharapov

1 answer 1

As an option, it is better to separate the contents of the filename by adding it to a separately created table, where there will be a link to u_login, and then delete it.

Then you don’t have to delete the whole entry that contains something else besides "22.jpg" in "filename".

PS Or delete using LIKE:

 DELETE FROM images_big WHERE filename LIKE '22.jpg%' 
  • Sori deleted the entire line, not a single item - Koly
  • So that this does not happen, and you need to create a separate table for the files, and there you should already store all the files separately with a binding, and it is better that the binding serves as a table 3, as is usually done: this is the right architecture. - Timur Musharapov
  • Separate the same element to remove using SQL is quite problematic. As @Mike correctly wrote in the comments above, you first need to read the contents of the filename, then do UPDATE, excluding the specific file from there. It is better not to go this way from the word at all. - Timur Musharapov