deepson2 Posted April 28, 2010 Share Posted April 28, 2010 Hello all, I am storing data from csv file to database. For one of the column i am storing description and this description has a few links like this- $string = " Lorem ipsum dolor sit amet,www.goggle.com.Aliquam pretium ullamcorper urna quis iaculis. Etiam ac massa sed turpis tempor luctus. Curabitur sed nibh eu elit mollis congue. Praesent ipsum diam, consectetur vitae ornare a, aliquam a nunc. In id magna pellentesque tellus posuere adipiscing. Sed non mi metus, at lacinia augue. Sed magna nisi,www.facebook.com,mollis sed nunc. Etiam at justo in leo congue mollis. Nullam in neque eget metus hendrerit scelerisque eu non enim. Ut malesuada lacus eu nulla bibendum id euismod urna sodales. "; So this description has two links goggle.com and facebook.com Now my questions are- 1) Can we store these links as links only into the database? 2) while selecting this row can i show the link as link only so user can click on this particular link and use it probably? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/200022-store-the-link-into-datbase-through-csv-file-and-fetch-it-as-a-link-only/ Share on other sites More sharing options...
ChemicalBliss Posted April 28, 2010 Share Posted April 28, 2010 Use preg_match_all to get all the links, then loop the result to create the INSERT query (however your db is structured), and voila, links in the db. php.net is all im gunna say, regex help is in a sub forum. good luck, -cb- Quote Link to comment https://forums.phpfreaks.com/topic/200022-store-the-link-into-datbase-through-csv-file-and-fetch-it-as-a-link-only/#findComment-1049822 Share on other sites More sharing options...
deepson2 Posted April 28, 2010 Author Share Posted April 28, 2010 Thanks for your reply ChemicalBliss, But my link titles are going to be changed every time so i can not match it with the exact link name. Any more suggestion? Quote Link to comment https://forums.phpfreaks.com/topic/200022-store-the-link-into-datbase-through-csv-file-and-fetch-it-as-a-link-only/#findComment-1049826 Share on other sites More sharing options...
ChemicalBliss Posted April 28, 2010 Share Posted April 28, 2010 huh? preg_match matches patterns not exact text. Go to php.net. and read about it. -cb- Quote Link to comment https://forums.phpfreaks.com/topic/200022-store-the-link-into-datbase-through-csv-file-and-fetch-it-as-a-link-only/#findComment-1049827 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.