MySQL Forums
Forum List  »  PHP

Re: Removing HTML tags using mysql
Posted by: Ranjita
Date: January 20, 2009 07:38AM

Hi,

Try this function....

DELIMITER $$

DROP FUNCTION IF EXISTS `removeHTML`$$

CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
FUNCTION `removeHTML`(strText longtext)
RETURNS longtext

BEGIN
declare nPos1, nPos2 int;

set nPos1 = InStr(strText, "<");
While nPos1 > 0 DO
set nPos2 = locate( ">", strText, nPos1 + 1);
If nPos2 > 0 Then
set strText = concat(Left(strText, nPos1 - 1), Mid(strText, nPos2 + 1));
End If;
set nPos1 = InStr(strText, "<");

END WHILE;
return strText;
END$$

DELIMITER ;

Options: ReplyQuote


Subject
Written By
Posted
Re: Removing HTML tags using mysql
January 20, 2009 07:38AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.