You are here: Re: mysql_connect works; DB::connect doesn't « PHP Programming Language « IT news, forums, messages
Re: mysql_connect works; DB::connect doesn't

Posted by lwoods on 08/05/05 16:56

Thanks, Justin,

I'll play around with it a little more but I think your way is best: Don't
use DB!

Larry

"Justin Koivisto" <justin@koivi.com> wrote in message
news:HUJIe.2097$Ra.12408@news7.onvoy.net...
> 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!";
> > }
> > ?>
>
> When using mysqli_* try also mysqli_select_db and mysqli_query to see if
> there are any odd errors there. Your dsn looks fine, and you check for
> an error the correct way for a PEAR package, but I don't use DB, so the
> only other suggestion I would have is to print_r the $db var if it is an
> error and inspect the other properties. Sometimes the PEAR::Error object
> holds more information than what is returned in getMessage (FME, anyway)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация