Jump to content


Photo

Please help


  • Please log in to reply
1 reply to this topic

#1 Bee

Bee
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 01 March 2006 - 10:50 AM

Hi,

I am having touble with this method. It's supposed to update records in a table.

function doModify($in){
        //$in[0] = "Mr";
        //$in[1] = "Jonny";  
        
        $sql = sprintf("UPDATE PersonalDetails SET Initials = '%s', Surname = '%s', Forename = '%s', Address = '%s', PostCode = '%s', TelHome = '%s', TelMobile = '%s', Email = '%s' WHERE UserID = '%s'", 
        $this->escape($in['Initials']) , 
        $this->escape($in['Surname']) , 
        $this->escape($in['Forename']) ,
        $this->escape($in['Address']), 
        $this->escape($in['PostCode']), 
        $this->escape($in['TelHome']), 
        $this->escape($in['TelMobile']),
        $this->escape($in['Email']), 
        $this->escape($in['UserID']) );//retrieves UserID from textbox
        
        // Trace the query in the NetConnection debugger
        NetDebug::trace($sql);
        // Run query on database
        $result = mysql_query($sql);
        // Check to see if the query did what it should have and return
        if (mysql_affected_rows() == 1) {
            return array("status" => "success");
        } else {
            return array("status" => "fail");
        } 
    }

Any suggestion will be very much appreciated

Bee

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 01 March 2006 - 07:39 PM

Nothing obviously wrong to me -- try adding a mysql_error() call after you query() attempt and see what the server says.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users