CodeIgniter Forums
Database with no tables returns error - 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 with no tables returns error (/showthread.php?tid=52599)



Database with no tables returns error - El Forum - 06-18-2012

[eluser]Marcone Ramos[/eluser]
Im trying to build an app that starts with an empty database. The database name, host, user and password is correctly set in the config file. The problem is that when the database doen't have any tables, it returns an error. Does anyone know to fix it?


Database with no tables returns error - El Forum - 06-18-2012

[eluser]Samus[/eluser]
Posting the error might possibly help.


Database with no tables returns error - El Forum - 06-18-2012

[eluser]Marcone Ramos[/eluser]
thank you for answering.
It's gives me a "HTTP Error 500 (Internal Server Error)".



Database with no tables returns error - El Forum - 06-18-2012

[eluser]TWP Marketing[/eluser]
Do you mean you nave no tables defined in your database? Then define an empty table.
If you mean you have no records in your table, then your code should test for this and create a record.
Please post your code so we can see what you are doing.


Database with no tables returns error - El Forum - 06-18-2012

[eluser]Marcone Ramos[/eluser]
I want the app run with no table defined in the database, it will install the tables according to user choices. Right now I have just a simple controller.

Code:
class bm_loader extends CI_Controller{

public function __construct() {
  parent::__construct();
  
}

function index() {
  echo 'debuggin';
}

}



Database with no tables returns error - El Forum - 06-18-2012

[eluser]InsiteFX[/eluser]
Well I just created an empty database with no tables and did not get any error.

You must have something like mysql installed wrong or your loading the ci database sessions without creating the table for them.

Error 500 is a server error which can be caused by bad code, it is not a mysql error.



Database with no tables returns error - El Forum - 06-18-2012

[eluser]emily12[/eluser]
I'm not sure why I had a 500 error when I forgot to add auto-indexing to one of my tables once. It only happened once and never again, mainly because sometimes you don't want auto-indexing. Anyways, you could always check the integrity of your table (repair) and see what that does. It's a peculiar problem if it's properly installed and the back-end code on your test website is correct.


Database with no tables returns error - El Forum - 06-20-2012

[eluser]Marcone Ramos[/eluser]
InsiteFX, you are right. I was loading the ci database sessions without a table for that.
Thank you guys!