Welcome Guest, Not a member yet? Register   Sign In
Active Record "insert" is not working properly
#21

[eluser]Daksh Mehta[/eluser]
yes, after successful use of commented condition, its working properly.
But, still its a problem why its not working without that condition..
#22

[eluser]waynhall[/eluser]
Can you post the view that submits to Register::process() ?
#23

[eluser]appleboy[/eluser]
I think that your model code as follows:

Code:
class Members extends CI_Model {
    
    public function register($username = NULL, $password = NULL, $email = NULL){
            
        $sqlq = "INSERT INTO members VALUES(?, ?, ?, ?)";
        $this->db->query($sqlq, array(NULL, $username, $password, $email));  
          
    }
}

It's all right that use default value to replace condition.

You can referrer system/database/DB_driver.php
Code:
/**
     * Compile Bindings
     *
     * @access    public
     * @param    string    the sql statement
     * @param    array    an array of bind data
     * @return    string
     */
    function compile_binds($sql, $binds)
    {
        if (strpos($sql, $this->bind_marker) === FALSE)
        {
            return $sql;
        }

        if ( ! is_array($binds))
        {
            $binds = array($binds);
        }

        // Get the sql segments around the bind markers
        $segments = explode($this->bind_marker, $sql);

        // The count of bind should be 1 less then the count of segments
        // If there are more bind arguments trim it down
        if (count($binds) >= count($segments)) {
            $binds = array_slice($binds, 0, count($segments)-1);
        }

        // Construct the binded query
        $result = $segments[0];
        $i = 0;
        foreach ($binds as $bind)
        {
            $result .= $this->escape($bind);
            $result .= $segments[++$i];
        }

        return $result;
    }




Theme © iAndrew 2016 - Forum software by © MyBB