|
Posted by Marcin Dobrucki on 09/29/78 11:23
Two things:
1) your DSN for the DB should be:
'mysqli://root:xxxx@localhost/restaurant'
(see details on:
http://pear.php.net/manual/en/package.database.db.intro-dsn.php)
2) You probably want to do this instead:
$db =& DB::connect(....);
There is little point copying the object.
And don't get discouraged. DB works very well indeed, and will allow
you to switch your DB at any point later (unlike using the mysqli...
methods).
/Marcin
lwoods wrote:
> When I execute the following script I can connect using 'mysqli_connect' but
> I get a "DB Error: Not Found" when I display the $db->Message() after
> attempting the DB::Connect.
>
> And, "yes", the "restaurant" database does exist.
>
> Where should I start looking?
>
> PHP 5.0.4 / mySQL 4.1.13-nt / IIS / XP Pro
>
> TIA,
>
> Larry Woods
>
>
> <?php
> require 'DB.php';
> $db=mysqli_connect('localhost','root','xxxx','restaurant');
> if (! $db ) {
> die("Can't connect: ".mysqli_connect_error());
> }
> else {
> echo "Connection successful!<br/>";
> mysqli_close($db);
> }
> $db=DB::connect('mysql://root:xxxx@localhost/restaurant');
> if (DB::isError($db)) {
> die($db->getMessage());
> }
> else {
> print "\$db connection was successful!";
> }
> ?>
>
>
Navigation:
[Reply to this message]
|