Jump to content

Is this alright?


Recommended Posts

You need to use mysql_num_rows(), as that query will always return true (unless there is an error), even if it has zero rows.

if (mysql_num_rows(mysql_query("SELECT Username FROM Members WHERE Username = $username" LIMIT 1")) == 1) {	die("$username is taken");}

Link to post
Share on other sites

it keeps saying:Parse error: syntax error, unexpected T_STRING in /register.php on line 20

<html><body><?php$username=$_POST['username'];$email=$_POST['email'];$password=$_POST['password'];$sql= mysql_connect("HIDDEN","HIDDEN","HIDDEN");$database=mysql_select_db("HIDDEN");if (!$sql){die('Could not connect: ' . mysql_error());}if (!$database){die ("Could not select db: " . mysql_error());}// Testing if (mysql_num_rows(mysql_query("SELECT Username FROM Members WHERE Username = $username" LIMIT 1")) == 1){die("$username is taken");}if (!mysql_query("INSERT INTO Member (Username, Password, Email, Folder)VALUES ('$username','$password','$email','http://thelostwaters.com/upload/$username/')")){die("Query failed: " . mysql_error());}mysql_close($sql);echo "You're registered as:<br>$username<br>Password<br>$password<br>Email:<br>$email<br>Your Folder:<br>http://thelostwaters.com/upload/$username";?></body></html>
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...