Jump to content

Recommended Posts

i am new to php and have downloaded some script. the instructions told me only to edit this bit to connect it to a mysql database:

 

$dbServer = "h41mysql19.secureserver.net";

$dbuserName = "kaikohe2";

$dbpassword = "**********";

$dbName  ="kaikohe2";

 

i really dont know where ive gone wrong? whenever i try and anything that uses the script it says "cannot find database". my website is hosted on godaddy and i have made databases using both versions 4.1 and 5.0 to see if i makes a difference. any help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/46336-solved-a-simple-question/
Share on other sites

Are the database credentials you are using correct? Are the ones godaddy supplied when you got your hosting account?

 

$dbServer = "h41mysql19.secureserver.net";

The line above should be the mysql servers hostname. If you don't know it localhost should do

 

$dbuserName = "kaikohe2";

The line above is the username for connecting to the MySQL server

 

$dbpassword = "**********";

The line above is the database for the username supplied above

 

$dbName  ="kaikohe2";

The line above is for your the database you wish to use.

what query are you using to connect to the database? it is not only important to have the correct parameters, but also to make sure they are embedded in the correct manner in the correct functions.

 

also, have you tried logging in and selecting the database from the command line?

forgive my ignorance but i really am a beginner at this.........selecting the database from the command line?

 

there are lots of different php scripts but according to the instructions the one called config.php is the only one i am meant to change. The whole of config.php goes like this:

 

<?

$dbServer = "localhost:3306";

$dbuserName = "kaikohe2";

$dbpassword = "******";

$dbName  ="kaikohe2";

 

 

///////////////////// DO NOY EDIT BELOW /////////////////////////////////////////

$con=mysql_connect ($dbServer, $dbuserName, $dbpassword) or die ('Cannot connect to the database.');

$db=mysql_select_db ($dbName);

session_start();

 

 

 

 

 

I dont know if thats anymore helpful?

no change without the port!

 

Sorry, I don't understand what you mean.

But for this

$dbServer = "localhost:3306";

You just have put

$dbServer = "localhost";

 

P.S: Please double check that your server, username, password and database are correct.

it doesnt make a difference when i change it to just "localhost".....thats what i meant by no change without the port!

ive logged in to my database with username and password so im guessing they are right....the only things left to be wrong are the dbserver and dbname........but im pretty sure they are right....

could it perhaps be some limitations on my hosting account that is causing the problems?? i am on godaddy economy hosting..?

 

economy hosting i would imagine is a relatively secure server. you may want to contact your hosting company and ask to speak with a level 2 technician.

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.