有错误号码的问题:1064(having issues with Error Number: 1064)

编程入门 行业动态 更新时间:2024-10-28 08:20:26
有错误号码的问题: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.php

Line 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);

更多推荐

本文发布于:2023-08-08 00:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466711.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有错误   号码   Number   Error   issues

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!