Jump to content

[SOLVED] [NEWBIE] Database help


boboreo1222

Recommended Posts

When I added it to the top of Index.php, I got

 

 

Warning: main(database/config.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 3

 

Warning: main(database/config.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 3

 

Warning: main(database/config.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 3

 

Warning: main(): Failed opening 'database/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bobbykig/public_html/index.php on line 3

 

Warning: main(database/login.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 6

 

Warning: main(database/login.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 6

 

Warning: main(database/login.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 6

 

Warning: main(): Failed opening 'database/login.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bobbykig/public_html/index.php on line 6

Wait, I see the problem

 

I guess that directory names are case sensitive because I can see a folder called "Database"

 

SO

 

this code

 

<?
ob_start();
include ("database/config.php");
?>
<?
include("database/login.php");
?>

 

should really be this

 

<?
ob_start();
include ("Database/config.php");
?>
<?
include("Database/login.php");
?>

 

does that work?

 

 

Nope

 

All I have on my site now is

 

Warning: mysql_connect(): Unknown MySQL server host 'database' (1) in /home/bobbykig/public_html/Database/config.php on line 3

 

Warning: mysql_select_db(): Access denied for user 'nobody'@'localhost' (using password: NO) in /home/bobbykig/public_html/Database/config.php on line 4

 

Warning: mysql_select_db(): A link to the server could not be established in /home/bobbykig/public_html/Database/config.php on line 4

Access denied for user 'nobody'@'localhost' (using password: NO)

 

The rest of my site isnt there

 

DO I ADD IT AT THE TOP OF MY PAGE?

Great, we're one step closer!

 

Okay, that means that your database connection info is all wrong

 

Are you sure that you set up the mysql database correctly?

 

What program does your webhost use?  Cpanel?

 

Can you please post the content of your config.php file?  remember to remove the username and password before posting it

 

 

Yes.  It uses cPanel

 

<?

  ob_start(); // allows you to use cookies

  $conn = mysql_connect("NAME OF THE DATABAE","USERNAME TO CONNECT","PASSWORD TO CONNECT");

  mysql_select_db(bobbykig_database) or die(mysql_error());

  //fill in the above lines where there are capital letters.

  $logged = MYSQL_QUERY("SELECT * from users WHERE id='$_COOKIE[id]'");

  $logged = mysql_fetch_array($logged);

  //the above lines get the user's information from the database.

?>

OK.  I added that to my username and database name

 

And it still appears with

Warning: mysql_connect(): Unknown MySQL server host 'bobbykig_database' (1) in /home/bobbykig/public_html/Database/config.php on line 3

Warning: mysql_select_db(): Access denied for user 'nobody'@'localhost' (using password: NO) in /home/bobbykig/public_html/Database/config.php on line 4

Warning: mysql_select_db(): A link to the server could not be established in /home/bobbykig/public_html/Database/config.php on line 4
Access denied for user 'nobody'@'localhost' (using password: NO)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.