The code below all works fine, referring to the SUBSTRING part, at the moment it just displays all the text from the "http" part until the end of the thread.
I am trying to get it to just grab the URL and display that only.
Expand|Select|Wrap|Line Numbers
- $sql= <<< END
- SELECT
- post_date
- , DATE_FORMAT(FROM_UNIXTIME( post_date ) , '%d-%m-%Y') AS formatted_date
- , LEFT(title, 30) AS title
- , post
- , SUBSTRING(post FROM LOCATE('http://',post) FOR 200) AS url
- FROM posts, topics
- WHERE post LIKE '%tp:%'
- AND topic_id = topics.tid
- AND forum_id = 29
- ORDER BY post_date DESC
- LIMIT 0 , 30
- END;
Expand|Select|Wrap|Line Numbers
- SUBSTRING(post FROM LOCATE('http://',post) FOR LOCATE(' ',xxxxx)-1)
like a string, but dont know how to reference it.
Can anyone help me please?
Thanks