|
Posted by Acrobatic on 12/03/07 14:44
Burnsy,
I use Pear DB too, and it works great. The only differences between
your script and mine are the dsn connection, I use "mysql" instead of
"mysqli," so try that first. Then check your connection string if that
doesn't work. I break mine down into an array because it's a little
clearer, ie:
---------------
$dsn = array(
'phptype' => 'mysql',
'hostspec' => 'localhost',
'database' => 'testdb',
'username' => 'root',
'password' => 'password'
);
$conn = DB::connect($myDSN);
---------------
See if that helps...
On Dec 2, 10:08 pm, bizt <bissa...@yahoo.co.uk> wrote:
> Hi,
>
> Ive just installed PEAR on my local machine and all is well, updated
> the include_path to point to my PEAR dir. So, when I just try to make
> a simple connection like so the script just seems to stop but no error
> messsages. I do get error messages normally (ie. when I can a method
> from an object that doesnt actually exist) as I have set
> display_errors = On in php.ini.
>
> Anyway, heres my code:
>
> <?php
>
> include('PEAR/DB/DB.php');
>
> $dsn = "mysqli://root:password@localhost/testdb";
> $conn = DB::connect($dsn);
>
> if (DB::isError($conn)) {
> print("Unable to connect to DB!!");
> die($conn->getMessage());
>
> }
>
> ?>
>
> Btw Im using MySQL 5 so I understand that the prefix above in the DSN
> should be 'mysqli'. My script just stops at theline ..
>
> $conn = DB::connect($dsn);
>
> .. with no error messages or any indicated that there was a problem
> until I place a ..
>
> print 'Hello world!';
>
> .. after it to see where the script ends - nothing is printed. Any
> ideas why this might be or how to gather some more information? Thanks
>
> Burnsy
[Back to original message]
|