有错误号码的问题:1064(having issues with Error Number: 1064)
每次我尝试访问我创建的页面时都会说:
错误号码:1064
您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便在第3行的''附近使用正确的语法
SELECT * FROM (`_db_tb_article`) WHERE `article_id` =文件名:
C:\xampp\htdocs\gtech\__ghtec__$y$tem__core\database\DB_driver.php电话号码:
330
这是我的模特
<?php class article_model extends CI_Model { function add() { $this->db->insert('article',$_POST); if($this->db->_error_number()){ return $this->db->_error_number(); } } function update($article_id, $data_fields = NULL){ if($data_fields == NULL){ $this->db->where("article_id =".$article_id); $this->db->update('article',$_POST); }else{ $this->db->where("article_id =".$article_id); $this->db->update('article',$data_fields); } $is_error = $this->db->_error_number(); if($is_error){ echo $is_error; } return TRUE; } function delete($id){ $this->db->where("article_id =".$id); return $this->db->delete('article'); } //return the article with this id function get_article($id){ $this->db->where("article_id =".$id); $query = $this->db->get('article'); if ($query->num_rows() > 0){ return $query->row_array(); } else { echo $this->db->_error_message(); return FALSE; } } //return the available article in the table function get_article_all(){ $query = $this->db->get('article'); if ($query->num_rows() > 0){ foreach($query->result() as $row){ $result[] = $row; } return $result; } } }我检查了330行,似乎无法找到解决问题的方法......我需要帮助
Any time I try to access a page I created it says:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
SELECT * FROM (`_db_tb_article`) WHERE `article_id` =Filename:
C:\xampp\htdocs\gtech\__ghtec__$y$tem__core\database\DB_driver.phpLine Number:
330
this is my model
<?php class article_model extends CI_Model { function add() { $this->db->insert('article',$_POST); if($this->db->_error_number()){ return $this->db->_error_number(); } } function update($article_id, $data_fields = NULL){ if($data_fields == NULL){ $this->db->where("article_id =".$article_id); $this->db->update('article',$_POST); }else{ $this->db->where("article_id =".$article_id); $this->db->update('article',$data_fields); } $is_error = $this->db->_error_number(); if($is_error){ echo $is_error; } return TRUE; } function delete($id){ $this->db->where("article_id =".$id); return $this->db->delete('article'); } //return the article with this id function get_article($id){ $this->db->where("article_id =".$id); $query = $this->db->get('article'); if ($query->num_rows() > 0){ return $query->row_array(); } else { echo $this->db->_error_message(); return FALSE; } } //return the available article in the table function get_article_all(){ $query = $this->db->get('article'); if ($query->num_rows() > 0){ foreach($query->result() as $row){ $result[] = $row; } return $result; } } }I have checked the line 330 and can't seem to find a way to solve that problem... I need help
最满意答案
在你的where声明中
功能更新
$this->db->where("article_id =".$article_id);应该
$this->db->where('article_id', $article_id);函数get_article
$this->db->where("article_id =".$id);应该
$this->db->where('article_id', $id);功能删除
$this->db-&t;where("article_id =".$id);应该
$this->db->where('article_id', $id);In your where statement
function update
$this->db->where("article_id =".$article_id);Should Be
$this->db->where('article_id', $article_id);function get_article
$this->db->where("article_id =".$id);Should Be
$this->db->where('article_id', $id);function Delete
$this->db->where("article_id =".$id);Should Be
$this->db->where('article_id', $id);更多推荐
发布评论