CodeIgniter Forums
[Database] Active Record produces database query errors - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [Database] Active Record produces database query errors (/showthread.php?tid=14365)



[Database] Active Record produces database query errors - El Forum - 12-30-2008

[eluser]Unknown[/eluser]
Hey guys,

I'm totally stuck on the following code:

Code:
$this -> db -> where ('name', $name);
$query = $this -> db -> get ($this -> tables['members']);
                
if ($query -> num_rows()) return true;
else return false;

The problem is, that I get the following error:

Quote:A Database Error Occurred

Error Number: 1054

Unknown column 'DayBay' in 'where clause'

SELECT * FROM (`guild_members`) WHERE `name` = DayBay

In this case, the following variables contain the following data:
$name = 'DayBay'.
$this -> tables['members'] = 'guild_members'.

The problem with the query is, that it's not adding the additional ' marks before and after the value (In this case DayBay).

Am I doing something wrong, or is it a bug?

Cheers for helping,


[Database] Active Record produces database query errors - El Forum - 12-30-2008

[eluser]Michael Wales[/eluser]
What version of MySQL / version of CodeIgniter?


[Database] Active Record produces database query errors - El Forum - 12-30-2008

[eluser]Unknown[/eluser]
[quote author="Michael Wales" date="1230700230"]What version of MySQL / version of CodeIgniter?[/quote]

The lastest SVN version: Dump 1595.