Question

I can't figure out whether it is possible to copy links from 1 mysql field to another?

In the first field there is some text with a simple URL at the end: <a target="_blank" href="http://www.link.com/sdsdg">Anchor</a>

So how can I separate each link from other text and copy that link into another mysql field?

Thank you very much. : )

Was it helpful?

Solution

Mysql has lots of string manipulation function See here

You can use these functions in a query for example: ( very simple example )

UPDATE table SET new_field = SUBSTRING(old_field, INSTR(old_field, '<a'), INSTR(old_field, '</a>') ) WHERE id = 10;

So with the use of SUBSTRING and INSTR and maybe a few others you can develop a query to do the job.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top