Welcome Guest, Not a member yet? Register   Sign In
How to return an empty string instead of null for $this->input->post()
#1

(This post was last modified: 03-18-2015, 08:55 AM by eldan88.)

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?
Reply
#2

Nevermind guys! I just figured to set the mysql column to NULL
Reply
#3

$the_string = (string) $this->input->post('the_string');
Reply




Theme © iAndrew 2016 - Forum software by © MyBB