I have table in my DataBase like this:-
ID Name Url Date
11 News title test2 22-10-2014
12 News title test3 22-10-2014
13 News title test4 22-10-2014
Now I need to copy the value from Name to Url and replace the space to -
So, The table must be like after copy :-
ID Name Url Date
11 News title test2 News-title-test2 22-10-2014
12 News title test3 News-title-test2 22-10-2014
13 News title test4 News-title-test2 22-10-2014
Are there way to do that by SQL or PHP
Simply update the table and use the REPLACE() function
UPDATE table
SET Url = REPLACE(Name,' ', '-')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With