Jump to content

eFlame

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

eFlame's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource i get the error twice, once for each mysql_num_rows, and then it says account created successfully when it hasn't been made in the database.
  2. Im quite new to php and am trying to make a signup script, so far my script contains the registration form, and the registration info, but when i try to use it i get a error, and i don't know what to do. reg_info.php <? include("config.php"); $check[0] = mysql_query("SELECT email FROM Account WHERE email = '$email'"); $check[1] = mysql_query("SELECT username FROM Account WHERE username = '$username'"); function user_valid($user) { if(!isset($user)) { $status = 0; $msg = $msg . "You have not inserted a username <br />"; } elseif(6 > strlen($user)) { $status = 0; $msg = $msg . "Your username must be longer than 5 characters <br />"; } elseif(strlen($user) > 30) { $status = 0; $msg = $msg . "Your username must be shorter or equal to 30 characters long <br />"; } else { $status = 1; $msg = $msg . ""; } } function pass_valid($pass, $pass2) { if(!isset($pass)) { $status = 0; $msg = $msg . "You need to enter a password <br />"; } elseif($pass != $pass2) { $status = 0; $msg = $msg . "Both passwords need to match <br />"; } elseif( 6 > strlen($pass)) { $status = 0; $msg = $msg . "Password must be longer than 5 characters <br />"; } elseif(strlen($pass) > 32) { $status = 0; $msg = $msg . "Password must be shorter or equal to 32 characters <br />"; } else { $status = 1; $msg = $msg . ""; } } function email_valid($mail) { if(!isset($mail)) { $status = 0; $msg = $msg . "Email must be entered <br />"; } elseif(6 > strlen($mail)) { $status = 0; $msg = $msg . "Email must be longer than 5 Characters long <br />"; } elseif(strlen($mail) > 30) { $status = 0; $msg = $msg . "Email must be shorter or equal to 30 characters long <br />"; } } function misc_valid($u_name, $e_mail) { if(mysql_num_rows($check[0])) { $status = 0; $msg = $msg . "Your email has already been taken. If you have forgotten your password use the forgot password link <br />"; } elseif(mysql_num_rows($check[1])) { $status = 0; $msg = $msg . "Your chosen username has already been used. Please go back and pick another <br />"; } else { $status = 1; $msg = $msg . ""; } } if(isset($reg) && $reg == "reg258741") { $status = 1; $msg = " "; user_valid($username); pass_valid($password, $password2); email_valid($email); misc_valid($username, $email); $md5password = md5($password); if($status == 0) { echo "<color = 'red'>" . $msg . "</color> <br /> <a href = 'register.php'> Go Back and try again </a>"; } else { mysql_query("INSERT INTO Account (username, password, email) VALUES ($username, $md5password, $email)"); echo "<color = 'green'> You have successfully registered <br />"; echo "An email has been sent to the email address provided you will need to activate your account before logging in <br />"; echo "Please <a href = 'login.php'>login here</a>"; } } else { echo "Please use the registration form"; } ?> config.php <? // Database Variables // $con = mysql_connect("localhost", "*******", "*********"); $db = "********"; // Form Variables // $username = $_POST['username']; $password = $_POST['password']; $password2 = $_POST['password2']; $email = $_POST['email']; $terms = $_POST['terms']; $reg = $_POST['reg258741']; ?> the error appears in the misc_valid function where im using mysql_num_rows, any help please
×
×
  • 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.