Switching between Databases at will in PHP MS SQL Server -


i'm making page modify values in databases, need able switch databases (sql sever) @ (they exact copies serve different purposes), , want in php, right conexion.php function included in every page, have been asked make page can select db (kinda settings page), , can't figure way tackle this.

i have database names, add them list box submit them, need sql query select database names , php db change, here connection file:

<?php session_start(); function conex() {     $db = "dfsistemasmercietdbtest";     $server = "dfsistemas";     $connectioninfo = array("database"=>$db, "uid"=>"sa", "pwd"=>"sa123456");     $conex = sqlsrv_connect($server, $connectioninfo);     if($conex === false)     {         die(print_r(sqlsrv_errors(), true));     }     return $conex; }    ?> 

the function called through pages with:

include('conexion.php'); $conex=conex(); 


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -