Re: Adding link to entry

From: Date: Thu, 17 Apr 2003 11:01:42 +0000
Subject: Re: Adding link to entry
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-27141@lists.php.net to get a copy of this message
<?PHP ## list($DiaryContent, $DiaryLink) = mysql_fetch_row(mysql_query("SELECT diaryContent, DiaryLink FROM mydb.diary WHERE date = 'YYYY-MM-DD'")); $DiaryContent = 'Yo, Yo! Wassup. This is my Diary, my name is {name} and this is a cool link to a website: {link}'; $DiaryReplace = '{name}*Bruce|{link}*<a href="http://www.google.com">www.google.com</a>|'; $DiaryReplace = explode('|', $DiaryReplace); foreach($DiaryReplace AS $Replace) { $Replace = explode('*', $Replace); $DiaryContent = str_replace($Replace[0], $Replace[1], $DiaryContent); } echo $DiaryContent; ?> There you go. Quick, clean, search and replace engine. Regards, Peter "Pod" Pistorius peterp@podbox.co.za

« previous php.db (#27141) next »