Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-29-2005, 03:14 PM "Database error"
Novice Talker

Posts: 11
Trades: 0
I have a problem: my site is all blank except two words on every page: "Database error". It is written in PHP and hosted on a VPS/VDS with a Plesk and Apache server. Now there were problems accessing phoMyadmin and root/ssh - root/ssh link was "dead" inaccessible and phpmyadmin kept giving notice "access denied". I have a developer working on my site and they had no idea why that happened, so I asked my VDS host and they told me why not I try resetting the site's database password in order to access phpMyadmin. I did and then I was able to access phpmadmin, but... shortly after that my site went down with only "Database error" text showing up and nothing else. The web dev who developed the site told me that the reason is that I changed the database password, so I changed it back to the "old" one, but my site still shows "Database error". Is this true that by editing/resetting/changing site's database password this can happen? Is there someone who can help restore my site?
neonrider is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-30-2005, 02:10 PM
celticbrue's Avatar
Extreme Talker

Posts: 175
Location: Wiltshire, England
Trades: 0
Hi there,

I think you need to approach this step by step and the first thing I would do is to try and identifyexactly what the Database Error is. The following code may be of some use to you in this respect. For my purposes, I have simply called it test_db.php. Upload it the server and then type the full url for the file into the address bar of your browser. It should print the actual database error to the screen, something like:

Warning: MySQL Connection Failed: Access denied for user: 'username_here@localhost' (Using password: YES) in c:\phpdev\www\simplesite\v4\test_db.php on line 10
Not connected : Access denied for user: 'username_here@localhost' (Using password: YES)


In the above case, the script has fallen over because the username is invalid.

Here's the code for test_db.php
PHP Code:
<?php

$host 
"localhost"// usually localhost
$user "username_here"// change this to your username
$password ="password_here"// your database password
$dbname "db_name_here"// your database name

//Connect to Database

$link mysql_connect ($host$user$password);

if (!
$link) { die('Not connected : ' mysql_error()); }

$db_selected mysql_select_db($dbname$link);
if (!
$db_selected) { die ("Can\'t use $dbName : " mysql_error()); }

?>
You appear to already have the necessary information regarding the passwords etc.

Hope this helps.
Regards
Ian
__________________
Found this useful? - HIT MY TALKUPATION!


Please login or register to view this content. Registration is FREE
celticbrue is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to "Database error"
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41135 seconds with 12 queries