Well, here's the deal - I had a SQL Server database with about 400,000 records that within one of the columns had urls in them that I wanted to turn into hyperlinks. So I wrote a program in vb that used regular expressions to change them over and one by one insert the records into a mysql database which is now on my server at hostgator(This process took forever). The problem is I was stupid and did not test it enough. It did not replace any of the urls that did not have a www in it. I need to find and replace with php and regular expressions then do an update(the cell is text) on the mysql database. Is this possible? - I normally do everything in ASP.NET and have never written anything in php - I am not asking anyone to write this for me but any help would be greatly appreciated. I hope this made sense. Thanks, Joe
They are URLs... and he knows he can do it with regex, he is asking how to do it practically. Something like this? mysql_connect('localhost', 'user', 'password'); mysql_select_db('your_db'); $res = mysql_query("SELECT field FROM table"); while ($row = mysql_fetch_array($res, MYSQL_NUM)) { $field = preg_replace('~(^|[^"\'])(http://(www\.)?(.+))(\s|$)~', '<a href="$2">$2</a>', $row[0]); mysql_query("UPDATE table SET field = '$field' WHERE field = '$row[0]' "); } PHP: