What you need to do is make a connection string, which depends on the database type you are using. Then you need to use the odbc_connect() function, like this:
PHP Code:
$server = ""; // The name of the database server goes here $database = ""; // The database name goes here $user = ""; // The database username goes here $pass = ""; // The database password goes here $connection_string = ""; // This is where your connection string goes $connection = odbc_connect($strconnect, $user, $pass); // Connect to database
To execute a database query, you need to use the odbc_exec() function:
PHP Code:
$query = odbc_exec($strconnect, // Query stuff goes here, store it in a variable);
To close the connection, use this:
PHP Code:
odbc_close($connection); // For MS servers use the odbc_free_result() command
You can view more info at:
http://www.php.net/manual/en/function.odbc-exec.php
and
http://www.php.net/manual/en/function.odbc-connect.php
I would also suggest downloading the PHP manual and you'll always have a functions list at your fingertips 
Last edited by cerebro89; 12-19-2005 at 06:57 AM..
|