Welcome Guest, Not a member yet? Register   Sign In
Hi I am getting a mysql error 1064 when inserting data is it me or my
#2

[eluser]Sally D[/eluser]
I got it to work by changing the code in my saveEmail function here is the updated version

but I had to hand code the sql.

Code:
function saveEmail($email)
    {
      
  
    
    $feildArray = array('from','subject','body');
                  
                    for($i = 1; $i <= sizeOf($email['body']); $i++)
                    {
                        $this->db->set('id',null);
                        foreach($feildArray as $val)
                        {
                            
                                $$val = $email[$val][$i];
                                
                              
                            
                        }

// this sql works It adds the email fields to the db

                         $sql = "INSERT INTO `email` ( `id` , `from` , `subject` , `body` ) VALUES ( NULL , '".$from."', '".$subject."', '".$body."') ";
                        
                         $this->db->query($sql);
                         if($this->db->affected_rows() == 1) { continue; } else { return false;}
                        
                    }
               return true;
        
      
    }


I wonder why I could not just use the $this->db->set('') with out getting a mysql errror 1064?


Messages In This Thread
Hi I am getting a mysql error 1064 when inserting data is it me or my - by El Forum - 09-29-2007, 05:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB