Missing quotes on DB query - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: Missing quotes on DB query (/showthread.php?tid=444) |
Missing quotes on DB query - coder - 12-05-2014 I'm writing a very simple DB query and struggling with CI not enclosing my string with quotes. The error I'm given is: Quote:Error Number: 1064 The error is obvious - Dark Horse should be in quotes to negate the space. Here's my code: Code: $this->db->select('ManufacturerID'); Am I missing something really obvious? I've never had to wrap quotes around variables. This is a fresh CI 2.2.0 install. RE: Missing quotes on DB query - coder - 12-05-2014 I've resolved this. I was populating the $manufacturer variable from a SimpleXML object, and it seemed to be doing something weird. Using type casting as string solved the issue. I changed the code: Code: $manufacturer = (string) $response->Manufacturer; Now everything is working as expected. |