Reputation: 31
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
Upvotes: 3
Views: 103
Reputation: 3417
Simply update the table and use the REPLACE()
function
UPDATE table
SET Url = REPLACE(Name,' ', '-')
Upvotes: 3