sql shorthand not working for me - 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: sql shorthand not working for me (/showthread.php?tid=22917) |
sql shorthand not working for me - El Forum - 09-23-2009 [eluser]battlemidget[/eluser] Code: function get_product_by_id($id) error: Code: A Database Error Occurred sql: Code: mysql> select product.* from product where product.id = '440'; What exactly am i doing wrong? $ pacman -Q mysql apache php mysql 5.1.38-1 apache 2.2.13-2 php 5.3.0-3 CI 1.7.2 EDIT: I've also done this very same thing on another CI project and it worked: Code: function getPropertyBySearch($loc, $p_start, $p_end, $bed) All settings are the same and both run on virtual ips on same box. sql shorthand not working for me - El Forum - 09-23-2009 [eluser]guillermo, out of repose[/eluser] [pre] function get_product_by_id($id) { $this->db->select('*')->from('product')->where('id', $id); $query = $this->db->get(); return $query->result(); } [/pre] sql shorthand not working for me - El Forum - 09-23-2009 [eluser]battlemidget[/eluser] Thanks but my problem is trying to deal with sql shorthand syntax sql shorthand not working for me - El Forum - 09-23-2009 [eluser]guillermo, out of repose[/eluser] Haven't tried this, but give it a shot and see what happens. More on the second parameter of the $this->db->select() can be found in the user guide: [pre] function get_product_by_id($id) { $this->db->select('product.*', false)->from('product')->where('product.id', $id); $query = $this->db->get(); return $query->result(); } [/pre] sql shorthand not working for me - El Forum - 09-23-2009 [eluser]battlemidget[/eluser] [quote author="guillermo, out of repose" date="1253752582"]Haven't tried this, but give it a shot and see what happens. More on the second parameter of the $this->db->select() can be found in the user guide: [pre] function get_product_by_id($id) { $this->db->select('product.*', false)->from('product')->where('product.id', $id); $query = $this->db->get(); return $query->result(); } [/pre][/quote] This works! Thanks for the quick response! -adam |