Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Adding Databases (http://www.mysidiaadoptables.com/forum/showthread.php?t=3750)

Kesstryl 06-07-2012 10:34 AM

Adding Databases
 
Is there any way to add databases, not tables, but whole entire databases? My hosting company limits my database size, and this will be a problem as the site grows, even with premium service which would give me unlimited amount of databases. I suppose transfering to a more expensive server option would do the trick, but as I'm a hobbyist right now with no way to pay for that, regular hosting is all I can afford at the moment. I like my company because it is very in-expensive and a green hosting company, plus I'm familiar with their tools.

Hall of Famer 06-07-2012 12:18 PM

umm it is possible, the database class is not singleton so you can instantiate as many database objects as you want.

Kesstryl 06-07-2012 03:03 PM

OK thanks, sorry, I am not an expert in these things. I'll have to look up how to do this

Hall of Famer 06-08-2012 12:30 AM

Well it is not difficult to instantiate database object, here is how the current database connection is carried out:

PHP Code:

try{
  
$adopts = new Database(DBNAMEDBHOSTDBUSERDBPASSPREFIX);
}
catch(
PDOException $pe){
  die(
"Could not connect to database, the following error has occurred: <br><b>{$pe->getmessage()}</b>");  


The database object accepts five arguments in its constructor, the database name, host, username, password and prefix. You can instantiate as many database objects as you wish by using this syntax below, which assumes that the database name differs but everything else remains the same

PHP Code:

$db1 = new Database(DBNAME1DBHOSTDBUSERDBPASSPREFIX);
$db2 = new Database(DBNAME2DBHOSTDBUSERDBPASSPREFIX);
... 

Hope this helps.

Kesstryl 06-08-2012 06:47 AM

thanks :) I appreciate this


All times are GMT -5. The time now is 12:55 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.