php mysql connection
Posted by: simondev
Posted on: 2003-12-08 23:41:00
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,
Thanks,
simon
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 = "mysql.xxxx.com";
$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";
}
?>