• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to return an empty string instead of null for $this->input->post()

#1
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.