Php mysql connection


Hi, I just signed up with DH and tyring to get my php scripts to write to my mysql database. Are you guys using pear - db.php? What about the DSN format?

I am getting an “access denied error”.

The only response I’ve gotten from DH is to set up an odbc.ini file. Is this what you guys are using? Can you please send me a snippet of your connection code?

Very much appreciated,

I can access my db no problem with the web interface same user, pass, and host name.

---------------------------test db script -------------

<?php require_once 'DB.php'; $user = "xxxxx"; $pass = "xxxxx"; $host = ""; $db_name = "xxxxx"; $dsn = "mysql://$user:$pass@tcp+$host/$db_name"; $db = DB::connect($dsn); if (DB::isError($db)) { echo $db->getDebugInfo(); } else { $email=$db->getOne("SELECT email from xxxxx_tbl where userID=1"); echo"the email is $email"; } ?>


Have you tried the example script at ? You don’t need to specify the protocol in the DSN. I tried that example and it worked for me, all I had to do was cut & paste and edit the varaibles and remove the ‘…’ and it worked, no odbc.ini file required. DH is running PHP 4.3.4 and the PEAR DB package that was released 9/14/2003.

:cool: Perl / MySQL / HTML CSS