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