Re: PEAR newbie trying to user PEAR DB and falling at the first hurdle



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...@xxxxxxxxxxx> 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



.



Relevant Pages

  • Re: dialup solution (as seconary connection / iptables )
    ... ip-down is launched by pppd only after the PPP link no longer available ... first with MINICOM or is PAP and script not mutualy exclusive? ... do have to "make the connection first with MINICOM." ... If you use the Linux box and route the news IP address to it on each ...
    (comp.os.linux.networking)
  • Re: mysqli connections and oop
    ... need to do all processing in a script before I display a page that will ... But it will most probably NOT terminated the execution of the script. ... this means that NO lasting connection is build ... Why does it not carry the mysqli connection? ...
    (comp.lang.php)
  • Re: mysqli connections and oop
    ... And here is the script that execute this ... lose a mysqli connection upon the reload of the page? ...
    (comp.lang.php)
  • Re: Does apache stop a script mid execution ?
    ... If the user calls a time consuming script and then stops or refreshes ... How does it relate to e.g. a script performing a large mysql query? ... 2.b) how the connection is set up. ... the server stops the script execution. ...
    (comp.lang.php)
  • Re: Keeping pppd alive--how?
    ... >>wrote a script to dial up my ISP, wait 40 seconds, then start up Jay's ... Perhaps using the netstat command to do ... >options tab is an option to redial is connection is lost. ... My Linux machine is text only--no GUIs. ...
    (alt.os.linux.redhat)

Loading