João Dias João Dias - 5 months ago 18
PHP Question

Remove HTML from Error Message In CodeIgniter

I have something like this in a CodeIgniter Model

$query = $this->db->insert('something',$data);

if($query)
{
return true;
}
else
{
return $this->db->_error_message();
}


What I would very much like to know is, how can I remove the html from the error template generated by CodeIgniter, when the
_error_message()
function is returned, keeping just the plain error message text?

Any ideas?

Answer
return strip_tags($this->db->_error_message());

it will strip everything in between <> I didnt know there was any css on page but you can then parse html with dom parser and return only plaintext from div with the id or class that you want

Comments