Welcome Guest, Not a member yet? Register   Sign In
Active Record "insert" is not working properly
#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;
    }


Messages In This Thread
Active Record "insert" is not working properly - by El Forum - 07-31-2011, 09:13 AM
Active Record "insert" is not working properly - by El Forum - 08-01-2011, 08:55 PM
Active Record "insert" is not working properly - by El Forum - 08-01-2011, 08:58 PM
Active Record "insert" is not working properly - by El Forum - 08-01-2011, 09:37 PM
Active Record "insert" is not working properly - by El Forum - 08-02-2011, 12:20 PM
Active Record "insert" is not working properly - by El Forum - 08-02-2011, 05:12 PM
Active Record "insert" is not working properly - by El Forum - 08-03-2011, 01:07 AM
Active Record "insert" is not working properly - by El Forum - 08-03-2011, 01:36 AM
Active Record "insert" is not working properly - by El Forum - 08-03-2011, 02:29 AM
Active Record "insert" is not working properly - by El Forum - 08-03-2011, 04:04 AM
Active Record "insert" is not working properly - by El Forum - 08-03-2011, 05:49 AM
Active Record "insert" is not working properly - by El Forum - 08-03-2011, 02:26 PM
Active Record "insert" is not working properly - by El Forum - 08-03-2011, 02:41 PM
Active Record "insert" is not working properly - by El Forum - 08-03-2011, 02:46 PM
Active Record "insert" is not working properly - by El Forum - 08-05-2011, 01:14 PM
Active Record "insert" is not working properly - by El Forum - 08-05-2011, 02:16 PM
Active Record "insert" is not working properly - by El Forum - 08-05-2011, 03:00 PM
Active Record "insert" is not working properly - by El Forum - 08-05-2011, 03:26 PM
Active Record "insert" is not working properly - by El Forum - 08-06-2011, 11:15 AM
Active Record "insert" is not working properly - by El Forum - 08-06-2011, 01:38 PM
Active Record "insert" is not working properly - by El Forum - 08-06-2011, 01:45 PM
Active Record "insert" is not working properly - by El Forum - 08-06-2011, 01:58 PM
Active Record "insert" is not working properly - by El Forum - 08-06-2011, 09:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB