Query returning no results? |
[eluser]Xabi87[/eluser]
Hi, I've just setup a new codeigniter instance, everything except the database connection is working fine. I've setup my config as follows (in config/database.php): Code: $active_group = 'default'; I've setup a query in a test model, and I'm seeing no errors (should I?), only no results: Code: $query = $this->db->get('Daemon'); This returns nothing. The query definitely returns a result, I'm using a mysql query browser session with the exact same connection info, same port, same user, and the same query is returning a result. I've enabled the profiler on the page and I can see the correct query in the 'DATABASE' section. Any ideas? I'd appreciate some further troubleshooting steps please! Thanks, Xabi
[eluser]techgnome[/eluser]
What does your controller and view look like? What about your model? You've given some snips there, but with out any context on how it all goes together. -tg
[eluser]Xabi87[/eluser]
Sorry, here's more info: The Controller: Code: <?php The Model: Code: <?php The view is not important. I'm simply trying to echo the query result from the model, and it's not working. Should it throw an error if the db connection is not correct? Thanks
[eluser]veritascs[/eluser]
Try something a little more simple (just to see if everything works). Using some examples from http://ellislab.com/codeigniter/user-gui...mples.html database.php Code: $active_group = "default"; controller testDB.php Code: <?php Notice I have debug on and am not calling a model or view. Does something more simple like this work for you? //fyi http://wallaholics.ever-flow.net/testDB
[eluser]CroNiX[/eluser]
And you are autoloading your database library I assume? Edit: looks like you solved it by the results on that page?
[eluser]InsiteFX[/eluser]
Code: echo "num rows:" . $query->num_rows(); InsiteFX
[eluser]Sweetsugar70[/eluser]
Hi guys new here,and find topics here very interesting, Hope I can join in your discussions here, God Bless! how to deal with depression
[eluser]InsiteFX[/eluser]
[quote author="Developer13" date="1289989256"]@InsiteFX - what part of what the OP posted suggests that $query should be $this->query? I don't think your response is valid.[/quote] Developer13, Sorry, but if you were here every morning and night going through all the topics looking for and flagging all the SPAM! I am sure you would make a mistake too! Then I have to meassge one of the EllisLab staff to get them deleted! Unless you want to spend all the time here and do it for me? InsiteFX
[eluser]Dennis Rasmussen[/eluser]
InsiteFX, don't be a douche... really. And I'm sure D13 also hits the report button once in a while - like the rest of us. For anyone reading this topic later and having trouble themselves, I believe the OP found out to always load the database (based on the info we got). |
Welcome Guest, Not a member yet? Register Sign In |