Try replacing that with this bit of code:

$db = mysql_pconnect("localhost", "testdb", "test123") or exit(mysql_error());

It should give you a more descriptive error message. Note I didn't put the "@", which 
is used to suppress error messages in PHP.

Adam Hooper
[EMAIL PROTECTED]

On 31 May 102 03:26:09 +0400
"Ricardo Fitzgerald" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I'm developing a web application using mysqld as a localhost but
> accessed from anywhere. My problem is simple, after entering form
> data, and execute the php script, always returns an error I wrote in
> case of unsuccesful connection to the db.
> 
> I did everything , create a user with many privileges, then flushed
> the privileges, if I use PhpMyAdmin to access the db I have no
> problems, the error happens when I use my program, what can be wrong
> 
> here are the lines I use to connect to the db and display error
> message:
> 
> @ $db = mysql_pconnect("localhost", "testdb", "test123");
> if (!$db)
> {
>  echo "Error: could not connect to database. Please try again later.";
>  exit;
> }
> mysql_db("mydb");
> ...
> 
> What can be wrong ?
> I'm starting to learn both php and mysql and I still can't understand
> why this happened.
> 
> Regards,
> Rick
> 
> AmpaSA Engineering
> 
> 
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to