Database problems

A

Anonymous

Guest
i am trying to repair a database i had made for me. when i upload it, it comes up with "Unable to connect to database." i have tried removing it see if i can get the basic site to load but i can't even get to remove it.

<? include 'functions.php';
databaselogin();
?>

this is at the top of the page but if i remove it there is no change. can somone suggest how i can make the database work please? or if i sent it to somone could they have a look?
 
scorpage said:
Code:
<? include 'functions.php';
databaselogin();
?>

We'd have to see the contents of functions.php, or at least the parts that relate to the databaselogin() function.
 
<?php
function databaselogin() {
mysql_connect("localhost","*****","*****")
or die ("Unable to connect to database.");
mysql_select_db("hindbacca_co_uk")
or die ("Unable to select database.");
}
function messagescreen($message, $title, $url, $type) {
?>

taken from functions.php


i think its that but what do i change it to? hindbacca and everything within that is relating to my mates site.
 
The code looks fine, so the problem is probably that either your database server is not running (or isn't running on localhost) or your username/password is wrong.

By the way, please don't post usernames/passwords to this board.
 
i apoligize mate ...i didn't know that was the username/password ..... what username/pass does it have to be the website un/pass ...or do you have to make one?

also what is this line for? what should i replace "hindbacca_co_uk"

mysql_select_db("hindbacca_co_uk")


thanks for the help so far
 
scorpage, I think you ought to learn PHP's MySQL functions for yourself. See the documentation, and I also recommend that you Google a few good tutorials. There's no sense in trying to fix something you don't understand.
 
thanks for the link swirlee

although i am a bit more understanding of it ...i still don't understand what to put as username and password? it just says
username = name of the user that owns the server process and password = empty password.

is that the website server? and do u leave the password empty?

also with mysql_select_db it says the name of your database
how do you name it?
 
Code:
mysql_connect("the_name_of_your_host","the_username_of_the_mysql_server","the_password_of_the_mysql_server") ;
mysql_select_db("the_name_of_the_database_where_your_tables_are");
I suggest you to try using your own code, so you will understand what you are doing.
There's no sense in doing something you just don't know, you'll end up asking questions in each step of your developement...
 
Hi scorpage,
Seems you are using the tripod.lycos.co.uk free php and mysql hosting ... ? Right ???

Now the username in this case is your login name for lycos, and there is no password

Code:
$conn = mysql_connect('localhost', 'scorpage', '');

And if even this doesn't work, try to deacitvate the PHP / MySQL for your ID on lycos and then reactivate.. It helped in my case!!
:lol:
hope it works for you [/code]
 
Back
Top