Jump to content

how to create and store in multiple database?


zgkhoo

Recommended Posts

Create a variable for a database and check it in if..else condition

 

if ($male) 
{
$sLocalDatabaseName = "male_db";
} 
else 
{
$sLocalDatabaseName = "female_db";
}

 

and after that you need to define your connection

$conn = mysql_connect($sLocalHost,$sLocalUser,$sLocalPassword);
$db=mysql_select_db($sLocalDatabaseName);

 

 

By the way, you can do this using 2 tables. No need of multiple DB.

n~ link=topic=167981.msg740495#msg740495 date=1195227370]

Create a variable for a database and check it in if..else condition

 

if ($male) 
{
$sLocalDatabaseName = "male_db";
} 
else 
{
$sLocalDatabaseName = "female_db";
}

 

and after that you need to define your connection

$conn = mysql_connect($sLocalHost,$sLocalUser,$sLocalPassword);
$db=mysql_select_db($sLocalDatabaseName);

 

 

By the way, you can do this using 2 tables. No need of multiple DB.

 

then how to switch between two or more tables?

 

n~ link=topic=167981.msg741358#msg741358 date=1195376146]

Are you really using more that 1 database. It will be a headache later... Same thing can be achieved through 1 database with two tables for male and female.

You're talking about vertical partitioning... that's an advanced technique.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.