Page 1 of 1

[function.mysql-connect]: Access denied for user

Posted: Thu Jul 23, 2009 3:57 am
by harshilshah
here's my code

Code: Select all

<?php
@session_start();
 // database code
$dbh=mysql_connect ("localhost", "root", "") or 
die('Cannot connect to the database because: ' . mysql_error());
  mysql_select_db ("wwwgodn_godnels");
  echo "Connection Successfull";
  
  
$sql="SELECT * FROM tblusers";
$result = mysql_query($sql) or die("Query failed with error: ".mysql_error());
 
echo "<table border=1><tr><td class=text>Username</td><td class=text>Password</td><td class=text>View</td><td class=text>Update</td></tr>";
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
echo "<tr><td class=text>".$row[0]."</td><td class=text>".$row[1]."</td><td><a href=view.php?txtusername=".$row[0]."&txtpassword=".$row[1].">View</a></td><td><a href=update1.php?txtusername=".$row[0].">Update</a></td></tr>";
}
echo "</table>";
mysql_free_result($result);
mysql_close($dbh);
 
?>
 

here's the error
i get

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'wwwgodn_godnel'@'localhost' (using password: YES) in C:\wamp\www\godnels\imagealbum\list1.php on line 12
Cannot connect to the database because: Access denied for user 'wwwgodn_godnel'@'localhost' (using password: YES)


Please someone help me figure out whats the problem with the code.
I haven't been able to debug the code yet.
any help would be greatful.

Re: [function.mysql-connect]: Access denied for user

Posted: Thu Jul 23, 2009 7:24 am
by spider.nick
The error is stemming from an incorrect username and password combination in your mysql_connect() statement.

Nick