SQL Server Not Returning Data - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: SQL Server Not Returning Data (/showthread.php?tid=62102) |
SQL Server Not Returning Data - bazianm - 06-09-2015 Hi, I have a model that has a simple query. Here's the code: PHP Code: $this->db->select("*") I have profile turned on and this is the query that is generated by this: Code: SELECT * When I copy this into SQL Server Management Studio, I get information returned. Yet, $result_array is coming back empty. I var_dumped both $query and $result_array and here is what I get from that. Code: object(CI_DB_sqlsrv_result)[16] No errors are returned. I have many other queries that work just fine. Any ideas at this point are appreciated. Thanks RE: SQL Server Not Returning Data - mwhitney - 06-09-2015 Did you try $query->result_array() instead of $query->result_array? Do you have autoinit set to true in your database config (or, if not, are you initializing your database connection)? RE: SQL Server Not Returning Data - Blair2004 - 06-09-2015 Actually result_array it's a method and not a property RE: SQL Server Not Returning Data - bazianm - 06-09-2015 (06-09-2015, 12:26 PM)mwhitney Wrote: Did you try $query->result_array() instead of $query->result_array? It was result_array(). Don't ask me how I missed that. I must have looked at that piece of code 1000 times! I wonder why PHP didn't kick that out as an error? THANKS for the assist! RE: SQL Server Not Returning Data - mwhitney - 06-10-2015 (06-09-2015, 02:14 PM)bazianm Wrote:(06-09-2015, 12:26 PM)mwhitney Wrote: Did you try $query->result_array() instead of $query->result_array? result_array is also a public property in the db library, but it doesn't necessarily have a value until you call one of the methods which populates it (like result_array()). RE: SQL Server Not Returning Data - bazianm - 06-10-2015 (06-10-2015, 06:32 AM)mwhitney Wrote:(06-09-2015, 02:14 PM)bazianm Wrote:(06-09-2015, 12:26 PM)mwhitney Wrote: Did you try $query->result_array() instead of $query->result_array? Oh OUCH! That's an error I will try not to make again. Cost me the better part of a day and a half of time. Thanks! RE: SQL Server Not Returning Data - lexxtoronto - 06-12-2015 >>I wonder why PHP didn't kick that out as an error? Is it in production mode? Errors will be suppressed. I also had a similar problem with db queries and it won't show any errors, but then I realized they were db generated errors and I wasnt catching them. RE: SQL Server Not Returning Data - Blair2004 - 06-13-2015 4 rows seems to be returned, use result_array() instead, since $result_array is empty |