CodeIgniter Forums
Error with active record when "script" in query - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Error with active record when "script" in query (/thread-39733.html)



Error with active record when "script" in query - El Forum - 03-18-2011

[eluser]Acidrain[/eluser]
I use CI 2.0.
I use Active Record

Code:
$this->db->insert('eve_characters', $data);

This is the error I get.
-------------------------

Quote:A Database Error Occurred
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 'Script, 90509708, Republic Military School, 1000170)' at line 1

INSERT INTO `eve_characters` (`characters_userid`, `characters_name`, `characters_charid`, `characters_corpname`, `characters_corpid`) VALUES ('1', G Script, 90509708, Republic Military School, 1000170)

Filename: D:\xampp\htdocs\eve\system\database\DB_driver.php

Line Number: 330

Help please.


Error with active record when "script" in query - El Forum - 03-20-2011

[eluser]Acidrain[/eluser]
Solved.

The data type was wrong in $data, so the active record built the query in the wrong way, hence no quotes in the query for strings.