-1
In Myssql I have a table like this:
I receive in a PHP via POST id of the table and which photo I must clean from the database:
id= 1
foto = aaa.jpg
With UPDATE need to leave the table like this:
That is, just clear the table field with id 1, where the value of the photo is equal to aaa.jpg. How to do it? The difficulty lies in knowing if the aaa.jpg photo is in the column FOTO1, FOTO2 or FOTO3
I believe it is with IF inside SET, something like this I imagine to be the way:
UPDATE tabela SET foto1 = '' IF(foto1='aaa.jpg'), foto2 = '' IF(foto2='aaa.jpg'), foto3 = '' IF(foto3='aaa.jpg')
WHERE id = '1'
Take a look in that question from SOEN, can help you
– Pedro Augusto
https://pastebin.com/XPsre3Yv
– Valdeir Psr
Hard to understand what you need... but let’s try!
– Sr. André Baill
@Valdeirpsr perfect! That was it.
– caiocafardo
Wouldn’t it be one of the solutions to your problem to create an n-table, multi-valued attribute? So you could search in the table by the name of the photo... Or even name your columns according to usage. Note: Now I understood what I wanted to ask kkk
– B. Fernandes