• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Join in not working with update

#1
Exclamation 
Join in not working with update  

Code:
            $this->db->join("voices","char_rel_id = voice_id","LEFT");
            $this->db->join("users","char_u_id = u_id","LEFT");

            $this->db->where("char_dialect IS NOT NULL");
            $this->db->where("char_flag",0);
            $this->db->where("char_temp",0);
            $this->db->where("voice_accepted",1);
            if(@$keywords){
                $this->db->group_start();
                foreach($keywords as $keyword){
                    $this->db->group_start();
                    $sub_keywords = explode("|",$keyword);
                    foreach($sub_keywords as $sub_keyword){
                        $this->db->or_like("char_dialect",$sub_keyword,"both");
                    }
                    $this->db->group_end();
                }
                $this->db->group_end();
            }           
            if(@$countries){
                $this->db->group_start();
                foreach($countries as $country){
                    $this->db->or_where("u_country",$country);
                }
                $this->db->group_end();
            }
           
            $data = array(
                "char_dialect_new" => $dialect->dialect_name,
                "char_flag" => 1,
            );       
           
            $this->db->set($data);   
                        
          echo $this->db->get_compiled_update("voices_characters");

And this is the output

Code:
UPDATE `sd_voices_characters` SET `char_dialect_new` = 'khaliji_fus-ha', `char_flag` = 1
WHERE `char_dialect` IS NOT NULL
AND `char_flag` = 0
AND `char_temp` = 0
AND `voice_accepted` = 1
AND   (
   (
`char_dialect` LIKE '%text%' ESCAPE '!'
  )
)
AND   (
`u_country` = 'DZ'
OR `u_country` = 'MA'
OR `u_country` = 'LY'
OR `u_country` = 'TN'
)
Reply

#2
@khashabawy,

What error messages are you seeing? Have you tried the generated sql statement directly in the database? If so, does it work or give you an error message?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.