TCH-RobertM Posted November 23, 2004 Posted November 23, 2004 Hello everyone I have a question about using MySql and PHP First off I am a Novice when it comes to Web applications and databases, I have been teaching myself xhtml and css and php So please bear with me.....Thanks in advance ok first things first I have created a database using CPANEL and created the table DORlist I have manually inserted rows of data into the table using phpAdmin I then created a webpage with php code to access the database and I am having problems with a few things First off if you look at my site and check out the MYSQL and MYSQL2 page on the nav bar you can see First that if I have the php code listed below active it breaks my layout. and even more distrubing is that it does not connect to my database My Database name is rmulher_mulhern1 the table I created in that database is DORlist > <? $username = "rmulher_rmul1966"; $password = "mypass"; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("<p>Unable to connect to MySQL</p>"); print "<p>Connected to MySQL</p>"; $selected = mysql_select_db("rmulher_mulhern1",$dbh) or die("<p>Could not select database</p>"); mysql_close($dbh); ?> Can anyone tell me whats happening here ? Thanks in advance Robert Quote
TCH-RobertM Posted November 23, 2004 Author Posted November 23, 2004 Well from all the testing I have been doing I think I have narrowed it down to the following problem MySQL says: 1044 : Access denied for user: 'rmulher_rmul1966@localhost' to database 'rmulher_mulhern1' need to find out how to resolve this I think it has to do with Grant privledges , I NEED A Manual bad lol Time to go to bookstore Quote
TCH-Don Posted November 23, 2004 Posted November 23, 2004 Did you in cpanel > phpMySql 1 create the database 2 create the user / password 3 add the user to the database the last step is often over looked. Quote
taznumber1 Posted November 23, 2004 Posted November 23, 2004 Also on TCH mysql your usrname would be something like rmulher_rmul1966@yourdomainname, for example if you registered tch domain you would use rmulher_rmul1966@tch.com as your username Quote
TCH-RobertM Posted November 23, 2004 Author Posted November 23, 2004 Thanks everyone, I think I have figured this out finally, It has to do with the "typical newbie" problem with username and password. I have corrected this and now am on the way to making it work as I hope. Thanks again Quote
borfast Posted November 23, 2004 Posted November 23, 2004 Glad you managed to fix it, Robert. Thumbs Up 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.