Thread: What's wrong?
View Single Post
Old 09-20-2007, 01:08 PM   #12 (permalink)
Karl
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

Almost, just a few minor adjustments.

PHP Code:
<?php
$sql 
sprintf('INSERT INTO
                    %1$s
                    (username, password, registerdate, registerip)
                VALUES
                    ("%2$s", "%3$s", "%4$s", "%5$s")
                ON DUPLICATE KEY
                UPDATE
                    username = "%2$s",
                    password = "%3$s",
                    registerdate = "%4$s",
                    registerip = "%5$s"'
,
                
$this->table['members'],
                
$this->data['username'],
                
$this->data['password'],
                
$this->data['registerdate'],
                
$this->data['registerip']);

$this->db->query($sql);  

?>
If the sprintf placeholders are confusing you in this example, I'd suggest reading Salathe's article which explains how to use them properly, the article can be viewed here.
Karl is offline  
Reply With Quote