Php Mysql Issues

liunx

Guest
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-->
 
Back
Top