Hi, I am trying to complete a product search page for a friends website. I am using a MySql table which contains 3 fields. Product ID, Product Name, Product Link. My search page works fine and brings up the relevant products when entered. The...
Hi,
I am trying to complete a product search page for a friends website. I am using a MySql table which contains 3 fields. Product ID, Product Name, Product Link. My search page works fine and brings up the relevant products when entered.
The data stored in the Product Link field is as follows -
http://www.url.com/product.html - when the search is complete this line of data displays correctly, however it is not linked. I did a quick shufty through help forums and found that to get it to link the ereg_replace might be a possible solution. After using this function the first part of my url is linked but not the extension O.o The php code I used is pasted below;
**$linkdesc variable contains the retrieved data that needs to be turned into a link.
PHP Code:
$text = $linkdesc;
$text = ereg_replace("[[:alpha:]]+://[^[:space:]]+[[:alnum:]/]","\\0",$text);
I'm kind of thinking my regex pattern isn't accomodating the /page.html part of my link, but im not 100% And I confess this is one of my first outings into PhP_World so it's a bit muddled in the ol' brain box.
Anyone have any ideas ?