Skip to main content
Participant
August 22, 2006
Question

Connecting to a database

  • August 22, 2006
  • 3 replies
  • 369 views

$root_url = " http://www.evergreen-hills-maze.com";
$root_dir = " http://www.evergreen-hills-maze.com";

// database settings
$db_hostname = " http://www.evergreen-hills-maze.com";
$db_name = "login";
$db_username = "root";
$db_password = "******";

Can someone please help me figure out what I'm doing wrong? I've tried using localhost; http://localhost; ~localhost after evergreen-hills-maze... I feel like I've tried everything. I can't get connected to the database.

Can you help me?!?!
This topic has been closed for replies.

3 replies

August 23, 2006
Error in Adding Database Name. On see this code, understood that added the table name instead of Database Name.

$db_name = "login";

Syntax:
$db_name = "[Database Name/Domain/IP Address]";
Inspiring
August 23, 2006
Fearknott wrote:
> $db_hostname = " http://www.evergreen-hills-maze.com";
> $db_name = "login";
> $db_username = "root";
> $db_password = "******";

Are you testing locally or on your remote server? From the information
you have given, it looks like a remote testing server. If so, do you
really have root access to MySQL? That's the MySQL superuser who has
complete control over all databases running on a server.

If you are testing locally, the hostname should be "localhost" (without
the quotes). For remote testing, it should be either "localhost" (again
without the quotes) or whatever your hosting company has told you to use.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Inspiring
August 23, 2006
There is some data on PHP & mysql database connection strings etc here if thats what your using.

http://uk.php.net/manual/en/function.mysql-connect.php

Going by what you have asked a basic connetion seems to be like

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

Hope thats of some help and in the right direction