Andrew L Posted August 16, 2006 Posted August 16, 2006 Can anyone please help? I'm trying to create a mysql database via the cpanel. I've create a new database and user, and linked them together. I get the following error message under Connection Strings, for PHP. $dbh=mysql_connect ("localhost", "iwzwsdsc_andrew", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("iwzwsdsc_testdb"); I need the PHP connection string to work... Thanks, Andrew Quote
TCH-Don Posted August 16, 2006 Posted August 16, 2006 I don't see your error message, just your code? here is my check list for databases -- databse connect ---- Be sure that in MySql you 1 - created the database 2 - created a user 3 -added the user to the database (go back to MySql and find the Add user select the user and database, and then Add user to database) Then to connect to the database in a script use: host: localhost database: yourCpanelName_databaseName user: yourCpanelName_databaseUser password: mypassword * Note password is just as the password, do not add the CpanelName to it. --------------------------- Quote
Andrew L Posted August 16, 2006 Author Posted August 16, 2006 Ah, OK, that's just me being totally ignorant of mySQL - it's the first time I've tried to do anything with it. I thought it was an error, not code. I'm using POG, and POG throws an error, saying I need to edit a script file with the database settings - as you've explained below. There are correctly entered as far as I know, so I'll try something else. Thanks, Andrew Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.