0

can i remove a specific word of a string from databse with php code?

For Example : change this string "http://cdn.domin.com/dl/video.mvk" to "/dl/video.mvk"

26th Dec 2019, 5:39 AM
shayan
shayan - avatar
5 ответов
+ 1
Yes you can but is the word changeable?
26th Dec 2019, 6:00 AM
ycsvenom
ycsvenom - avatar
+ 1
So you can do as follow $str = "link" ; $replace ="/dl/video.mkv "; $str = substr($str, strpos($str, $replace), strlen($replace)) ; Then update the value in database
26th Dec 2019, 6:38 AM
ycsvenom
ycsvenom - avatar
+ 1
thank you all
26th Dec 2019, 7:18 AM
shayan
shayan - avatar
0
yes
26th Dec 2019, 6:18 AM
shayan
shayan - avatar
0
UPDATE <table_name> SET <column_name> = REPLACE(<column_name>, 'http://cdn.domin.com/', '/'); Assuming <table_name> is name of the table, and <column_name> is name of the column that needs to be replaced Try to execute this query. Mind you though, I haven't tested the query, but I suppose you can play or tweak it in case it doesn't work 😁 * Reference: https://www.w3resource.com/slides/mysql-string-functions.php
26th Dec 2019, 6:30 AM
Ipang