woocha Posted September 3, 2008 Share Posted September 3, 2008 Hi guys, I have a script that pulls info from a db and I need to determine if the db field contains ul for this I used: if(strstr($row['body'],ul)){} but now I need to know how to insert </p> before the ul is read from the db. I am doing this so that the page validates. I DO NOT want to alter the db field. I just want to change the string before it is displayed to the browser. Does anyone have any ideas? thanks guys and gals Link to comment https://forums.phpfreaks.com/topic/122542-solved-php-search-string-and-if-ltulgt-is-in-string-insert-ltpgt-before-ltulgt/ Share on other sites More sharing options...
BlueSkyIS Posted September 3, 2008 Share Posted September 3, 2008 maybe something like... $new_body = str_replace('<ul>','</p><ul>',$row['body']); [code] [/code] Link to comment https://forums.phpfreaks.com/topic/122542-solved-php-search-string-and-if-ltulgt-is-in-string-insert-ltpgt-before-ltulgt/#findComment-632711 Share on other sites More sharing options...
woocha Posted September 3, 2008 Author Share Posted September 3, 2008 AWESOME.....Thank you...That's great...I can't believe i didn't think of it. Link to comment https://forums.phpfreaks.com/topic/122542-solved-php-search-string-and-if-ltulgt-is-in-string-insert-ltpgt-before-ltulgt/#findComment-632733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.