SQL Server Not Returning Data |
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
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)?
Actually result_array it's a method and not a property
NexoPOS 2.6.2 available on CodeCanyon.
(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! (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()). (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!
>>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.
Do the one thing you think you cannot do. Fail at it. Try again. Do better the second time. The only people who never tumble are those who never mount the high wire.
4 rows seems to be returned, use result_array() instead, since $result_array is empty
NexoPOS 2.6.2 available on CodeCanyon.
|
Welcome Guest, Not a member yet? Register Sign In |