Opens an existing database or creates a new one. If the database is not found, it will be created and opened.
resource db_open_database(string database [, string path [, string username [, string password]]])
The result will be a database resource if successful or NULL otherwise.
// 1. Open SQWLite database
include "db_common.inc.php";
define("WB_DATABASE", "SQLite");
define("PATH_DATA", "C:\winbinder\myApp\"); $database = "sample";
$dbhnd = db_open_database($database, PATH_DATA);
// opens the database c:\winbinder\myApp\SQLite_sample.db
// 2. Open MySQL database
include "db_common.inc.php";
define("APPPREFIX", "myDB_");
define("WB_DATABASE", "mySQL");
$database = "test";
db_open_database($database, $server = "192.168.168.133", $username = "root", $password = "");
// opens the database test on server 192.168.168.133 with user root and no password
// all tables will have a prefix myDB_ not seen by the application