![]() |
$this->db->lastquery() not working - 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: $this->db->lastquery() not working (/showthread.php?tid=37167) Pages:
1
2
|
$this->db->lastquery() not working - El Forum - 12-30-2010 [eluser]D-dawg[/eluser] I'm dazzled as to what is causing this error. I'm simply writing $this->db->lastquery(), and I don't even get an error - the output is just nothing (""). I tried print_r($this->db->lastquery()) and the output was "1" Am I missing a helper or something - have I destroyed the beautiful codeigniter framework? Can I ever feel happy after such a hideous crime? $this->db->lastquery() not working - El Forum - 12-30-2010 [eluser]WanWizard[/eluser] It has to be $this->db->last_query() $this->db->lastquery() not working - El Forum - 12-30-2010 [eluser]D-dawg[/eluser] It actually was ![]() Code: return "query: ".$this->db->last_query(); and I only see "query:" $this->db->lastquery() not working - El Forum - 12-31-2010 [eluser]SPeed_FANat1c[/eluser] you should show more code then $this->db->lastquery() not working - El Forum - 12-31-2010 [eluser]D-dawg[/eluser] Sure How I call it is in my model: Code: function lastquery() then I call my Model by doing Code: function lastquery_get() in this case I serve it as a REST response hence the response($var,200); but as I said I only get "query: " Please let me know what other pieces of code you'd want to see. $this->db->lastquery() not working - El Forum - 12-31-2010 [eluser]SPeed_FANat1c[/eluser] show the code before lastquery_get call. Maybe dumb question, but do you execute any queries before you call last_query? $this->db->lastquery() not working - El Forum - 12-31-2010 [eluser]D-dawg[/eluser] I'm not quite following - everything is in functions. The controller itself is extending Phil Sturgeons RESTController, and I have no constructor. I don't know how comfortable I am dumping the entire controller code, but on the other hand I would appreciate the help, is there some way to post the code discretely ![]() $this->db->lastquery() not working - El Forum - 12-31-2010 [eluser]D-dawg[/eluser] [quote author="SPeed_FANat1c" date="1293821877"]show the code before lastquery_get call. Maybe dumb question, but do you execute any queries before you call last_query?[/quote] I don't consider it a dumb question, I've asked myself this, and I'd say that the answer was yes. To my understanding it is supposed to give me the last processed query. I have first made calls to methods that queried the db, and gave me the correct results, and thn tried calling lastquery, but without luck. I may have misunderstood it though, that's always an option, so thank you for asking. $this->db->lastquery() not working - El Forum - 12-31-2010 [eluser]Atharva[/eluser] Again, you need to show the code before last_query() was called. It's not clear from your code which query is being called. $this->db->lastquery() not working - El Forum - 01-02-2011 [eluser]D-dawg[/eluser] There are different, but an update would look like: Code: function SetMarker($data, $id) I know they work since the job gets done, still lastquery returns nothing. Is there another way with codeigniter or phpmyadmin I can view the entire last query? |