I get these errors:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'a2955851'@'localhost' (using password: NO) in /home/a2955851/public_html/register.php on line 25
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'a2955851'@'localhost' (using password: NO) in /home/a2955851/public_html/register.php on line 26
and i get these errors:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/a2955851/public_html/register.php on line 25
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/a2955851/public_html/register.php on line 26
there is my code:
<!doctype html>
<html lang"fi">
<head>
<link rel="icon" type='image/png' href='images/logo.png'>
<title> ASD</title>
<link href="css/styles.css" type="text/css" rel="stylesheet">
</head>
<body>
<!--reg alkaa-->
<form action="register.php" method="post">
<p><input type="text" name="username" placeholder="Username">
<p><input type="email" name="email" placeholder="Email">
<p><input type="password" name="pass" placeholder="Password">
<p><input type="password" name="pass1" placeholder="Password">
<p><input type="submit" name="submit" value="Register">
</form>
<?php
if (isset($_POST['submit'])) {
$username = mysql_real_escape_string($_POST['username']);
$pass = mysql_real_escape_string($_POST['pass']);
$pass1 = mysql_real_escape_string($_POST['pass1']);
$email = mysql_real_escape_string($_POST['email']);
if ($username && $pass && $pass1 && $email) {
if ($pass==$pass1) {
$connect = mysql_connect("mysql13.000webhost.com","a2955851_SW","********");
mysql_select_db("a2955851_SW");
$query = mysql_query("INSERT INTO users VALUES('$username','$pass','$email');");
echo "You have been registered.";
} else {
echo "Password must match.";
}
} else {
echo "All fields are required.";
}
}
?>
<!--reg loppuu-->
<Center>
<a href="index.php">
<h1> ASD </h1>
</center>
</a>
<div id="main">
<h3>
<div class="menu"> <a href="index.php">Etusivu</a> •
<a href="https://www.google.fi/">Kaikkee</a> •
<a href="https://www.mediafire.com/">Lataukset</a> </div>
</h3>
</div>
<div class="jonne"> </div>
<script src="javascript/jquery.js"></script>
</body>
</html>
What did I do wrong? i use 000webhost and i'm noob. My english skill is very bad, sorry.