Thread: What's wrong?
View Single Post
Old 09-20-2007, 11:02 AM   #1 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default What's wrong?

PHP Code:
public function save() {
        
            
            if(isset(
$this->data['u_id'])) {
                
                
// UPDATE query on database
                
$this->db->query("UPDATE ".$this->table['members']." (`u_id`, `username`, `password`, `registerdate`, `registerip`) VALUES ('".$this->data['u_id']."', '".$this->data['username']."', '".$this->data['password']."', '".$this->data['registerdate']."', '".$this->data['registerip']."') WHERE `u_id` = '".$this->data['u_id']."'");
        
            }

            else {
                
                
// INSERT query on database
                
$this->db->query('INSERT INTO ' $this->table['members'] . ' VALUES (NULL, ' $this->data['username'] . ', ' $this->data['password'] . ', ' $this->data['registerdate'] . ', ' $this->data['registerip'] . ')');
            
            }
    
        } 
Gives me this:
Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`u_id`, `username`, `password`, `registerdate`, `registerip`) VALUES ('', 'Tana' at line 1
Tanax is offline  
Reply With Quote