CodeIgniter Forums

Full Version: How to return an empty string instead of null for $this->input->post()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey Guys,

As mentioned in the title, I want to return an empty string because mysql won't let me insert value as NULL. I tried making the following changes from this
PHP Code:
public function post($index NULL$xss_clean NULL)
    {
        return 
$this->_fetch_from_array($_POST$index$xss_clean);
    } 

to this
PHP Code:
public function post($index ""$xss_clean NULL)
    {
        return 
$this->_fetch_from_array($_POST$index$xss_clean);
    } 

But it still returns NULL. Any suggestions on how i can do that?
Nevermind guys! I just figured to set the mysql column to NULL
$the_string = (string) $this->input->post('the_string');