Jump to content

thelostdutchmann

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by thelostdutchmann

  1. solved it the mysq_error told me that no database was selected my classmate gave me the wrong database name
  2. hey i was typing a smale login code but i keep geting this waring Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/u400486/domains/u400486.gluweb.nl/public_html/lekkerpittig/register.php on line 17 and it won't save on my table but i tink thats becouse of the waring can someone help out <?php include('config.php'); if($_SERVER['REQUEST_METHOD'] == 'POST'){ $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string(md5($_POST['password'])); if(empty($username)){ echo("you have to fill in an username!"); } else{ if(empty($password)){ echo("you have to fill in a password!"); } else{ $query = mysql_query("SELECT * FROM users WHERE username ='$username'"); $rows = mysql_num_rows($query); if($rows > 0){ die ("Username taken!"); }else{ $user_input = mysql_query("INSERT INTO users(username , password) VALUES('$username' , '$password')"); echo("succesfully registered!"); } } } } ?> <html> <head> <title>register</title> </head> <body> <form action="register.php" method="post"/> username: <input type="text" name="username"/> <br /> password: <input type="password" name="password"/> <br /> <input type="submit" value="resister!" /> </form> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.