Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[PHP] connecting to a database

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
PL99
Posts: 22
Joined: 2004-03-05 21:43
Location: Austria

[PHP] connecting to a database

#1 Post by PL99 »

I think I have to edit some config file someware because I'm getting a strange error. ( Or at least I think it's a little odd.)

I know the the database "report" exists, I made it with phpmyadmin.
I have the following code :

Code: Select all

mysql_connect($db_host,$user, $passwd) or die ("Failed to connect to the MySQL server!"); 
mysql_select_db ("report") or die ("Failed to connect to the database!");
and I get the following error:
Failed to connect to the database!

Somebody an idea what's the problem?

THX

User avatar
MarkvD
Posts: 77
Joined: 2004-02-15 21:36
Location: Rhoon, Holland

#2 Post by MarkvD »

Try

Code: Select all

mysql_connect("$db_host",$user, "$passwd") or die ("Failed to connect to the MySQL server!");
and:

Code: Select all

mysql_select_db ("report") or die (mysql_error()); // to get get information about the error

PL99
Posts: 22
Joined: 2004-03-05 21:43
Location: Austria

#3 Post by PL99 »

Thanks,

mysql_select_db(); gave an error.
The user could not log in.
$db_user, $user and $passwd where not known, The include file where they were defined wasn't ok.

Everything is ok now, Thanks.

Post Reply