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

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

?>

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

You were mis informed my friend

 

<?php
<?
mysql_connect("hostname", "username", "password"); // ntoes hostname should be "localhost"
mysql_select_db("dbname");

?>

 

www.php.net/mysql_connect

www.php.net/mysql_select_db

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.