Hello everyone,
I am working on a project and this is the error I keep getting..
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\member-form.php on line 69
error on connect

Can someone help me understand..

this is my code

<?php
function FormDisplay($strMessage="**All fields are required!"){
echo "<p><strong>".$strMessage."</strong></p>\n";
echo "<form action=\"".$PHP_SELF."\" method=\"post\">\n";
echo "<table width=\"300\" cellpadding=\"2\" cellspacing=\"2\">\n";
echo "<tr>\n";
echo "  <td><strong>Username:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"username\" value=\"". $_POST['username']."\"/></td> \n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>Password:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"password1\" /></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>Repeat Password:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"password2\" /></td>\n";
echo "<tr>\n";
echo "  <td><strong>First Name:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"firstname\" value=\"". $_POST['firstname']."\"/> \n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>Last Name:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"lastname\" value=\"". $_POST['lastname']."\"/> \n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>Email:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"email\" value=\"". $_POST['email']."\"/> \n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>Address:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"address\" value=\"". $_POST['address']."\"/> \n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>City:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"city\" value=\"". $_POST['city']."\"/> \n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>State:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"state\" value=\"". $_POST['state']."\"/> \n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>Zip:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"zip\" value=\"". $_POST['zip']."\"/> \n";
echo "</tr>\n";
echo "<tr>\n";
echo "  <td><strong>Phone:</strong></td>\n";
echo "  <td><input type=\"text\" name=\"phone\" value=\"". $_POST['phone']."\"/> \n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>&nbsp;</td>\n";
echo " <td><input type=\"submit\" name=\"submit\" value=\"Sign Up Now!\" class=\submit\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}
  if ($_POST['submit']!=""){
	if($_POST['username']==""||$_POST['password1']==""||$_POST['password2']==""||$_POST['firstname']==""||$_POST['lastname']==""||$_POST['email']==""||$_POST['address']==""||$_POST['city']==""||$_POST['state']==""||$_POST['zip']==""||$_POST['phone']=="")
	$error=1;
}
   else if($_POST['password1']!=$_POST['password2']){
	$error=2;
}
else{
	$Hostname="localhost";
	$database="Contacts";
	$username="Web_User";
	$password="my1230";

	if (!(mysql_connect($hostname, $mysql_login, $mysql_password))){
		echo "error on connect";
	}
	else{
		if (!(mysql_select_db($database,$db))){
			echo mysql_error();
			echo "<br>error on table connection";
		}
		else{
			$SQL="Insert into tblUsers(username,password,firstName,lastName,email,address,city,state,zip,phone,signupDate) values('".$_POST['username']."'.PASSWORD('".$_POST['password1']."'),'".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['email']."','".$_POST['address']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['phone']."',NOW())";
			mysql_quert($SQL);
			if (is_numeric(mysql_insert_id())){
				header("Location:member-content.php?name=".$_POST['username']);
			}
			else{
				echo "Sorry, there was an error.Please try again or contact the administrator . Please try again later.";
			}
			mysql_close($db);
		}
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <link href="file1.css" rel="stylesheet" type="text/css"  />
<title>Signup page</title>
</head>

<body>


<br />
<h2>Become a member of the coolest website on the net!</h2>
<br />
<?php
if ($error==1){
	FormDisplay("**You did not enter all required fields**");
}
elseif($error==2){
	FormDisplay("**Your Passwords did not match**");
}
else{
FormDisplay();
}
?>
<div id="footer">
<br />
<p id="links"><a href="#">Link</a>| <a href="#">Link</a>|</p>
<p style="font-size:9px;">Family Reunion 2011</p>
</div>
</div>
	</body>
</html>

The error must almost certainly be in the data you specified to connect to your MySQL database. For example you could have set a wrong username, password, host, etc. to connect to your database. Make sure you double check it, and then try again :).

Check lines 64-69. The defined variables are not used in your mysql_connect.

You also have an error on line 79: mysql_quert($SQL) should be mysql_query($SQL)

OK question so I should set the hostname which is local host but the passwords and user to what I have in there through my mysql

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.