![]() |
Database doesn't work on server but works locally - 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: Database doesn't work on server but works locally (/showthread.php?tid=50594) |
Database doesn't work on server but works locally - El Forum - 04-01-2012 [eluser]mojitoo[/eluser] Hey! I need som help. This code works perfect when I execute it locally but it doesn't work when I upload it to a server. You're able to see that I've added some code to the database that tells me that the connection is OK! database.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); controller, site.php Code: <?php model, site_model.php Code: <?php You're able to see a var_dump in my model that returns bool(false) I also get this error: Fatal error: Call to a member function result() on a non-object in /home/site/public_html/test/application/models/site_model.php on line 12 Please try to help me with this, it's really frustrating since it works locally. Database doesn't work on server but works locally - El Forum - 04-01-2012 [eluser]InsiteFX[/eluser] I would check your hosting providers versions of MySQL and PHP Database doesn't work on server but works locally - El Forum - 04-01-2012 [eluser]mojitoo[/eluser] mysql: 5.0.95 php: 5.2.17 Any help? Database doesn't work on server but works locally - El Forum - 04-01-2012 [eluser]pbflash[/eluser] Did you update the username, password, and database name? Database doesn't work on server but works locally - El Forum - 04-01-2012 [eluser]aquary[/eluser] I'm guessing you are using an older version of CI? I remember the old version would return a FALSE when the query return empty result.... Either upgrade the CI version or check of the $query is FALSE should fix the problem... hmm, read it again and it seems to be different. It was about "$query->result() return a FALSE" not "$query is FALSE". Anyway, what are your CI version? Did you also dump database data, or only structure? What happen if you run the query manually via mysql_query()? do you get any result? Edit: just finish checking the mysql driver, the only case (as of CI 2.1) where you would get FALSE from the $this->db->get() is when you have error in the query somewhere... might be not useful, but make it as a note here ![]() Database doesn't work on server but works locally - El Forum - 04-01-2012 [eluser]mojitoo[/eluser] Hey again! I found the problem with help of my host. My database user had somehow been disconnected from this table. Thanks for all your help! |