This topic is locked

Use existing connection script

1/10/2005 4:25:21 PM
PHPRunner General questions
P
pj_canada author

I want to integrate the application I am trying to build with an existing database connection as detailed below.

<script language="php">

$db_username = "username";

$db_password = "mypassword";

$db_name = "mydatabase";

$db_host = "localhost";
$dbh=mysql_connect($db_host, $db_username, $db_password) or die ('You need to set your database connection in vsadmin/db_conn_open.php.</td></tr></table></body></html>');

mysql_select_db($db_name) or die ('You need to set your database connection in vsadmin/db_conn_open.php.</td></tr></table></body></html>');

</SCRIPT>


Is it possible to use this connection with PHPRunner - the connection script resides in another directory off of the root to that of the phprunner files.

Admin 1/12/2005

Hi
You can modify function db_connect() in file dbconnection.php for this purpose.

function db_connect()

{

$db_username = "username";

$db_password = "mypassword";

$db_name = "mydatabase";

$db_host = "localhost";
$dbh=mysql_connect($db_host, $db_username, $db_password) or die ('You need to set your database connection in vsadmin/db_conn_open.php.</td></tr></table></body></html>');

mysql_select_db($db_name) or die ('You need to set your database connection in vsadmin/db_conn_open.php.</td></tr></table></body></html>');


return $dbh;

}