RE: [PHP-DB] Problem connecting to db on Linux
| From: | Rick Emery | Date: | Mon, 18 Feb 2002 14:31:19 +0000 |
| Subject: | RE: [PHP-DB] Problem connecting to db on Linux | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-17027@lists.php.net to get a copy of this message | ||
Have you spelled the name of the database correctly, including case
sensitivity?
What error message are you getting to indicate failure?
-----Original Message-----
From: George Pitcher [mailto:fmdev@yahoo.co.uk]
Sent: Monday, February 18, 2002 8:21 AM
To: Greg Donald; php-db@lists.php.net
Subject: Re: [PHP-DB] Problem connecting to db on Linux
Greg, et al,
This is the contents of the include file:
<?php
$link = mysql_connect ('localhost', 'root', '*****') or die
("Could not
select db");
mysql_select_db ('Heronsql') or die ("Could not connect");
?>
I have also tried it with the following:
<?php
$link = mysql_connect ('localhost', 'root', '*****');
echo mysql_errno().": ".mysql_error()."<BR>";
mysql_select_db ('Heronsql');
echo mysql_errno().": ".mysql_error()."<BR>";
?>
Te results for this were:
0:0
0:0
I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to
retest so I'll report back soon.
George
----- Original Message -----
From: "Greg Donald" <greg@ascendantmedia.com>
To: <php-db@lists.php.net>
Sent: Monday, February 18, 2002 2:08 PM
Subject: Re: [PHP-DB] Problem connecting to db on Linux
> > I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks.
> > I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have
> moved
> > my files across.
> >
> > I use an include file which logs on to the MySQL server and then
connects
> to
> > the database. It performs the login ok but not the select db part.
> >
> > I tried creating a db using a php script and then selecting it and got
the
> > same problem.
> >
> > I'm new on Linux so it might be something in the configuration which
needs
> > working on.
> >
> > Any suggestions?
>
> Well, if you had posted some code, someone might have seen the error...
:(
>
> Anyway, here is how i do it:
>
> if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
> mysql_select_db($dbname, $db);
> } else {
> echo mysql_error();
> exit;
> }
>
> ------------------------------------------------------------------------
> Greg Donald - http://destiney.com/
> http://phprated.com/ |
> http://phplinks.org/ |
> http://phptopsites.com/
> ------------------------------------------------------------------------
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php