João Dias João Dias - 1 year ago 115
PHP Question

Remove HTML from Error Message In CodeIgniter

I have something like this in a CodeIgniter Model

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

return true;
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
function is returned, keeping just the plain error message text?

Any ideas?

Answer Source
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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download