我收到一条错误消息,提示“您的 SQL 语法有错误;请检查与您的 MariaDB 服务器版本相对应的手册以了解要使用的正确语法”我还是 codeigniter 的新手,目前我确实需要帮助,这是我一直在尝试应用的代码function save() { $reporter=$this->Settings_m->greporter(); $jabrik=$this->Settings_m->gjabrik(); $redpel=$this->Settings_m->gredpel(); $usertxt=""; if (in_array($this->session->userdata('ugroup'), $reporter )) { $usertxt=",reporter=".$this->user.",reporter_time=now()"; } if (in_array($this->session->userdata('ugroup'), $jabrik )) { $usertxt=",jabrik=".$this->user.",jabrik_time=now()"; } if (in_array($this->session->userdata('ugroup'), $redpel )) { $usertxt=",redpel=".$this->user.",redpel_time=now()"; } /* end for usertxt call */ if($this->input->post('pub') == 1){ if($this->input->post('tglpub') == "0000-00-00 00:00:00" || $this->input->post('tglpub') == ""){ $tgl=",publish_up=now()"; }else{ //$tgl = $this->input->post('tglpub'); $tgl = ",publish_up='".$this->input->post('tglpub')."'"; } }else{ $tgl=",publish_up=''"; } $title =str_replace('"',"'",$this->input->post('title')); $query=" insert gis_news_items set " .' title="' .$title.'"' .",alias='" . $this->input->post('alias',true )."'" .",introtext='". $this->input->post('content')."'" .",fulltexts=' '" .",catid=".$this->input->post('catid') .",published=".$this->input->post('pub') // .",hl=".$this->input->post('hl') // .",focus=".$this->input->post('fcs') }
2 回答
慕容708150
TA贡献1831条经验 获得超4个赞
试试sql
$query=" insert gis_news_items (title, alias, introtext, fulltexts, catid, published, modified_by, metadesc, metakey ) values
('".$title."', '".$this->input->post('alias',true )."', '". $this->input->post('content')."',' ', ".$this->input->post('catid').", '".$this->input->post('pub').$usertxt."', ".$this->user.$tgl.", '".str_replace('"',"'", $this->input->post('deskripsi',true) )."', '".str_replace('"',"'", $this->input->post('keyword',true) )."' ) ";
- 2 回答
- 0 关注
- 122 浏览
添加回答
举报
0/150
提交
取消