Jump to content

Recommended Posts

Posted

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>

Posted

Try logging in with your cpanel username and password (don't post it here!).

Posted
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.

Posted

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.

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...