Ruslan Wahyudi Ruslan Wahyudi - 7 months ago 7
HTML Question

How to take specific string in column mysql?

I have a table column that contain string like this :

<p><img alt="" src="http://www.kpu.go.id/application/modules/post/images/2d9af6bbca18d3faa06458a058df851d.jpg" style="height: 267px; width: 500px;" /></p>


I want to take just string in src, i mean url link of image. how to do this??

Answer

You could use this :

SUBSTR(column, LOCATE(column, 'src="'), LOCATE(column, '"', LOCATE(column, 'src="'))

That would get the substring starting with src=" until the first " after that.

Comments