njaohnt Posted August 12, 2011 Share Posted August 12, 2011 I have a PHP script that comes out with this response: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'njaohnt_jzaucts'@'localhost' (using password: YES) in /home1/njaohnt/public_html/status.php on line 2 Could not connect: Access denied for user 'njaohnt_jzaucts'@'localhost' (using password: YES) Here's my code, and I'll change the password later. <html><body><?php $con = mysql_connect("localhost","njaohnt_jzaucts","passwordhere"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("njaohnt_jzdbauctions", $con); $result = mysql_query("SELECT * FROM Persons"); echo "<table border='1'> <tr>"; for ($i2=0; $i2<16; $i2++) {echo "<th>" . $bidrow[$i2] . "</th>";} echo "</tr>"; $bidrow=array("Title","Timed","Timeh","Timem","Times","Owner","bidtyal","Prdes","cat","typs","chats","bidhi","Peobidg","curam","topbidr"); while($row = mysql_fetch_array($result)) { for ($i=0; $i<16; $i++) { echo "<tr>"; echo "<td>" . $bidrow[$i] . "</td>"; echo "</tr>"; } } echo "</table>"; mysql_close($con); ?> </body></html> Quote Link to comment Share on other sites More sharing options...
Guest Geoff Posted August 12, 2011 Share Posted August 12, 2011 Try logging in with your cpanel username and password (don't post it here!). Quote Link to comment Share on other sites More sharing options...
PenTester Posted August 12, 2011 Share Posted August 12, 2011 Are you sure about database and passwords? Once again check it Quote Link to comment Share on other sites More sharing options...
njaohnt Posted August 13, 2011 Author Share Posted August 13, 2011 I used the password for my cPanel, and it worked! Thank you. Quote Link to comment Share on other sites More sharing options...
Krydos Posted August 13, 2011 Share Posted August 13, 2011 I used the password for my cPanel, and it worked! Thank you. That means that you didn't have your user or permissions set up correctly for the database you were trying to use. Your cpanel login and password is basically root for your database and has all permissions. Quote Link to comment Share on other sites More sharing options...
njaohnt Posted August 14, 2011 Author Share Posted August 14, 2011 I did though. I set all permissions to that user. Quote Link to comment Share on other sites More sharing options...
PenTester Posted August 16, 2011 Share Posted August 16, 2011 Your data is right and you have set all permission but still have problem? I am not able to realize what is your problem. But suppose if i got this problem, i'll create a simple php file to test the connection. Quote Link to comment Share on other sites More sharing options...
njaohnt Posted August 27, 2011 Author Share Posted August 27, 2011 I don't know what happened, but now it works with my original code. Quote Link to comment Share on other sites More sharing options...
PenTester Posted August 30, 2011 Share Posted August 30, 2011 Some miracles! Glat your problem solved Quote Link to comment Share on other sites More sharing options...
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.