Re: Trouble with mysql_pconnect unable to connect to database?
| From: | Jim Hankins | Date: | Mon, 25 Mar 2002 04:20:59 +0000 |
| Subject: | Re: Trouble with mysql_pconnect unable to connect to database? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89972@lists.php.net to get a copy of this message | ||
No, the @ was in the right place (if memory serves me the book said this
suppresses the error output.) The problem was my sock file was not in the
default location so I had to specify it. If you check the thread the answer
is there on how to find where your sock is located.
Best Regards,
Jim Hankins
"Gerard Samuel" <gsam@trini0.org> wrote in message
news:3C9D563A.3000702@trini0.org...
> Is that supposed to be ->
> $db = @mysql_pconnect("localhost", "bookorama", "bookorama123");
>
> Jim Hankins wrote:
> > I'm doing a simple database connection using the follow syntax:
> >
> > <html>
> > <head>
> > <title>Book-O-Rama Search Results</title>
> > </head>
> > <body>
> > <h1>Book-O-Rama Search Results</h1>
> > <?
> > if (!$searchtype || !$searchterm)
> > {
> > echo "You have not entered search details. Please go back and try
> > again.";
> > exit;
> > }
> >
> > $searchtype = addslashes($searchtype);
> > $searchterm = addslashes($searchterm);
> >
> > @ $db = mysql_pconnect("localhost", "bookorama",
> > "bookorama123");
> >
> > if (!$db)
> > {
> > echo "Error: Could not connect to database. Please try again
later.";
> > exit;
> > }
> >
> > When I go to the search page and hit submit (after removing the @ to
see an
> > error on the mysql_pconnect line)
> > I get Warning: Can't connect to local MySQL server through socket
> > '/tmp/mysql.sock' (2) in
/home/jhankins/public_html/mydirectory/results.php
> > on line 17
> >
> > I can telnet to the host and with the same username and password access
the
> > database tables etc. What gives? I'm using
> > 4.0.6 of PHP and apache under Redhat Linux 7.2. Mysql is working fine
from
> > command line and remote via odbc?
> >
> > Also tryed mysql_connect with same problem.
> >
> >
> >
> >
> >
> >
>
>