• Vuki
  • Born
  • Born
  • Vuki
  • Posts: 1

Post 3+ Months Ago

I have recently brought a hosting sever with MyPhpAdmin. In there I have a database and I also created a table called 'users'. This table contains things like username, password, e-mail, etc. The problem being when i uploaded a db.php on my ftp I tried to Login by it tell me that It can not connect to the sever, I was wondering if anyone can help me?

This is my db.php file.

/* Database Information - Required!! */
/* -- Configure the Variables Below --*/
$dbhost = '';
$dbusername = '';
$dbpasswd = '*****';
$database_name = 'abna_ca';

/* Database Stuff, do not modify below this line */

$connection = mysql_pconnect($dbhost,$dbusername,$dbpasswd)
or die ("Couldn't connect to server.");

$db = mysql_select_db("$database_name", $connection)
or die("Couldn't select database.");

And heres the website.
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4579
  • Loc: Maryland

Post 3+ Months Ago

this is the basic script I use to connect to the database:
Code: [ Select ]
mysql_connect("$sql_host", "$sql_un", "$sql_pass") or
    die ("Could not connect to database");
mysql_select_db($sql_db) or
    die ("Could not select database");
  1. mysql_connect("$sql_host", "$sql_un", "$sql_pass") or
  2.     die ("Could not connect to database");
  3. mysql_select_db($sql_db) or
  4.     die ("Could not select database");

I Believe what you have is the database is storing the boolean returned in the variable, so if you echo $connection you should get something like true or false, I don't think it will connect you.
  • tierra
  • Student
  • Student
  • User avatar
  • Posts: 91

Post 3+ Months Ago

Also, it might be helpful to note that once you have the script uploaded to your webhost, chances are that the MySQL server is on the same host meaning you can just use 'localhost'.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 44 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.