MySQL Database

ID #191

How can I use odbc_connect() in my PHP scripts to connect to MySQL?

Applies to: Grid System

You can just override the built-in PHP function with a user function like the one below, which would be included by all your scripts that need to connect to your database:

function odbc_connect($dsn, $user, $pass, $curs = "") {
return mysql_connect("DBSERVER", $user, $pass);
}

and then it will work without rewriting anything.

An easy way to include the above in every script you have is to use auto_prepend_file.


Last update: 2010-10-03 16:27
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 0 (0 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
hmm, thats quite of a show, creating custom function odbc_connect and wrote inside a mysql function, not bad but for full feature on odbc_connect() see http://makeitworth.phpnet.us/?p=16
Added at: 2010-02-07 20:31