I am not sure what is going wrong but I have not changed any of my codes and now I am getting this error message on a simple form that I am testing. Any idea what has happened. I have had several successful tries that have updated to the db.
Warning: mysql_query() [function.mysql-query]: Access denied for user 'ebermy5'@'localhost' (using password: NO) in /home/ebermy5/public_html/form.php on line 20
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/ebermy5/public_html/form.php on line 20
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebermy5/public_html/form.php on line 21
Warning: mysql_query() [function.mysql-query]: Access denied for user 'ebermy5'@'localhost' (using password: NO) in /home/ebermy5/public_html/form.php on line 29
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/ebermy5/public_html/form.php on line 29
This is the form
<?php
@include_once ("Connections/connect_to_mysql.php")
or die('could not connect to database');
$err='';
if($_POST["submit"]){
// Validate form data
if($_POST["firstname"]=='') $err.='Please enter First Name<br>';
if($_POST["email"]=='') $err.='Please enter Email<br>';
if($err==''){
// Check if there are duplicate entries in the 'contacts' table
$results = mysql_query("SELECT id FROM `Members` WHERE firstname='".addslashes($_POST["firstname"])."' and Email='".addslashes($_POST["email"])."'");
if($row = mysql_fetch_array($results)){
$err.='Can not add duplicate entry<br>';
}
else{
// adding new record to 'contacts' table
mysql_query("INSERT INTO Members (firstname,lastname,country,Email)
values ('".addslashes($_POST["firstname"])."','".addslashes($_POST["lastname"])."','".addslashes($_POST["country"])."','".addslashes($_POST["email"])."')");
// redirecting to success screen
exit;
}
}
}
?>
<html>
<head>
<title>Add New Contact</title>
</head>
<body>
<h2>Register with us</h2>
<?php echo $err==''?'':('<p style="color:red;">'.$err.'</p>') ?>
<form method="post" action="form.php">
<table border="0">
<tr>
<td valign="middle">First Name:</td>
<td><input type="text" name="firstname" size="30" value="<?php echo htmlspecialchars($firstname) ?>"></td>
</tr>
<tr>
<td valign="middle">Last Name:</td>
<td><input type="text" name="lastname" size="30" value="<?php echo htmlspecialchars($lastname) ?>"></td>
</tr>
<tr>
<td valign="middle">Country:</td>
<td><input type="text" name="country" size="30" value="<?php echo htmlspecialchars($country) ?>"></td>
</tr>
<tr>
<td valign="middle">Email:</td>
<td><input type="text" name="email" size="30" value="<?php echo htmlspecialchars($email) ?>"></td>
</tr>
</table><br>
<input type="submit" name="submit" value=" Submit! ">
</form>
</body>
</html>