Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Connecting to a database

New Here ,
Aug 22, 2006 Aug 22, 2006

$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?!?!
TOPICS
Server side applications
348
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 22, 2006 Aug 22, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 23, 2006 Aug 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 23, 2006 Aug 23, 2006
LATEST
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]";
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines