You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near
https://lamtakam.com/qanda/2831/You-have-an-error-in-your-SQL-syntax-check-the-manual-that-corresponds-to-your-MariaDB-server-version-for-the-right-syntax-to-use-near 1سلام. این فایل من متاسفانه خطای دستوری بخاطر ورژن از mysql 5.6 / mysql 5.7 با Maria DB داره و کلی کاره منو عقب انداخته. ممنون میشم کمکم کنید. (فریم ورک کد ایگنایتر)
متن خطا :
A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' `public_sts`, `author_id`, `time`, `up_author_id`, `uptime`) VALUES ('', '', 15' at line 1
INSERT INTO `form_critics` (`shop_name`, `name`, `order_date`, `recive_date`, `invoce_num`, `type_order`, `city`, `nahveye_order`, `apply_type`, `critics_type`, `custumer_offer`, `keyfiyat_type`, `packaging`, `pro_keyfi`, , `public_sts`, `author_id`, `time`, `up_author_id`, `uptime`) VALUES ('', '', 1579798800, 1579798800, '', '', '', '', '', '', '', '', '', '', NULL, 0, '1', 1579824999, 0, '')
Filename: models/public_forms/Model_form_critics.php
Line Number: 23
کد صفحه مدل :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Model_form_critics extends CI_Model {
private $primary_key = 'id';
private $record_sts = '0';
private $table_name = 'form_critics';
private $field_search = ['br1579806241392', 'shop_name', 'name', 'order_date', 'recive_date', 'invoce_num', 'type_order', 'city', 'nahveye_order', 'apply_type', 'critics_type', 'custumer_offer', 'keyfiyat_type', 'packaging', 'pro_keyfi', 'pic_file'];
public function __construct()
{
$config = array(
'primary_key' => $this->primary_key,
'table_name' => $this->table_name,
'field_search' => $this->field_search,
);
parent::__construct($config);
}
public function store($data = array())
{
$this->db->insert($this->table_name, $data);
return $this->db->insert_id();
}
public function remove($id = NULL)
{
if ($this->record_sts == 0){
$this->db->where(array($this->table_name.'.author_id' => $this->user->info->ID, $this->table_name.'.'.$this->primary_key => $id));
} else{
$this->db->where($this->primary_key, $id);
}
return $this->db->delete($this->table_name);
}
public function change($id = NULL, $data = array())
{
if ($this->record_sts == 0){
$this->db->where(array($this->table_name.'.author_id' => $this->user->info->ID, $this->table_name.'.'.$this->primary_key => $id));
} else{
$this->db->where($this->primary_key, $id);
}
$this->db->update($this->table_name, $data);
return $this->db->affected_rows();
}
public function find($id = NULL, $select_field = [])
{
if (is_array($select_field) AND count($select_field)) {
$this->db->select($select_field);
}
if ($this->record_sts == 0){
$this->db->where(array($this->table_name.'.author_id' => $this->user->info->ID, $this->table_name.'.'.$this->primary_key => $id));
} else{
$this->db->where($this->table_name.'.'.$this->primary_key, $id);
}
return $this->db->get($this->table_name);
}
public function findRaw($id = NULL)
{
$this->db->where($this->table_name.'.'.$this->primary_key, $id);
return $this->db->get($this->table_name);
}
public function find_all()
{
$this->db->order_by($this->primary_key, 'DESC');
if ($this->record_sts == 0) $this->db->where($this->table_name.'.author_id', $this->user->info->ID);
$query = $this->db->get($this->table_name);
return $query->result();
}
public function find_all2()
{
$this->db->order_by($this->primary_key, 'DESC');
if ($this->record_sts == 0) $this->db->where($this->table_name.'.author_id', $this->user->info->ID);
return $this->db->get($this->table_name);
}
public function get_all_data($table = '')
{
$query = $this->db->get($table);
return $query->result();
}
public function get_single($where)
{
$query = $this->db->get_where($this->table_name, $where);
return $query->row();
}
public function check_repetitive($id, $fieldName, $field_val)
{
if ($id <= 0){
$res = $this->db->where(array($fieldName => $field_val))->get($this->table_name);
if ($res->num_rows() > 0) return false;
}else{
$res = $this->db->where(array($fieldName => $field_val, 'ID <> ' => $id))->get($this->table_name);
if ($res->num_rows() > 0) return false;
}
return true;
}
}