I have to update the column File
on the TABLE TEST
. This column contains the files related to the row. Each file is separated by a |
.
An example could be
ID NAME FILE
1 apple fruit.png | lemon.png
Now when I add a new file to the FILE
column I use this query:
$link->query("UPDATE TEST SET File = CONCAT(File, '$dbfilename') WHERE id = '$p_id'")
where $dbfilename
can be e.g. pineapple.jpg |
The problem is that, if $dbfilename
is already on the File
values, it will be added another time, resulting double.
How can I check if File
contains already $dbfilename
, and if yes, don't add id, or even don't execute the query?