Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter2.11 sql variable type problems
#1

[eluser]smartweb[/eluser]
My code is no problem in version 2.1. But converted to Version 2.11, a serious error.


$this->db->update('articles',$save,'id ='.$id);





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 '`=6`' at line 1
UPDATE `cms_articles` SET `title` = 'ABCDE' WHERE `id` `=6`
Filename: D:\xampp\htdocs\www\6083\system\database\DB_driver.php
Line Number: 330
#2

[eluser]victorcl[/eluser]
try
$this->db->update("articles",$save,"id = $id");
#3

[eluser]smartweb[/eluser]
The best is

$this->db->where('id =',$id)->update('articles',$save);
#4

[eluser]smartweb[/eluser]
$this->db->where(‘id’,$id)->update(‘articles’,$save);
#5

[eluser]smartweb[/eluser]
$this->db->update(“articles”,$save,“id = $id”);


NOT OK!
#6

[eluser]kanjimaster[/eluser]
Are you using the most recent zip? Asking because the error causing this was reverted and a new download archive was made available, but still named as 2.1.1.
#7

[eluser]smartweb[/eluser]
I would like to download there is an error. I downloaded the file creation date is June 12. The CI2.11 creation date is June 13.




Theme © iAndrew 2016 - Forum software by © MyBB