Hi Team, Basically what I have done is created a website for storing my clients business data. It uses mostly forms to display the information and is uploaded and retrieved via a MySQL DB. Each client will have their own database but all database structures are the same. What I am trying to achieve is to have a login page that creates a script that connects the user to the correct database based on their login credentials. I really don’t know where to start. Have tried searching for something similar but have had no luck even tried writing a script but that didn’t seam to work.
As the clients are businesses they have staff and more than one user will have to be able to connect to each database with different authentication levels.
I was thinking something like this:
[php]
while ($row = mysql_fetch_array($query)) {
// Gather all $row values into local variables
$db_database = $row[“dbcon_name”];
$db_username = $row[“dbcon_user”];
$db_password = $row[“dbcon_pass”];
}
//connect to userDB
$hostname_mycon = “$localhost”;
$database_mycon = “$db_database”;
$username_mycon = “$db_username”;
$password_mycon = “$db_password”;
$mycon = mysql_pconnect($hostname_mycon, $username_mycon, $password_mycon) or trigger_error(mysql_error(),E_USER_ERROR);
?>
UserName: Password
[/php]I don’t mind if I have to write a seperate script for each client (business) and set it up as http://domain.com/clientname.php
Yes I am a noob but have been studying php pretty hard recently. Done about 20 tutorials in the last few weeks.
Any help or direction would be much appreciated.
Thanks in advance guys.