PHP noob, creating registration system error -
i attempting write user registration system web site. running php 5 on web server , getting error:
parse error: syntax error, unexpected ';' in /nfs/.../processreg.php on line 18
line 18: if (mysql_num_rows($s?>0))
the rest of code this:
<?php include("db.php"); if (isset($_post['username']) && isset($_post['password']) && isset($_post['email'])) { //prevent sql injections $username = mysql_real_escape_string($_post['username']); $email = mysql_real_escape_string($_post['email']); //get md5 hash of password $password = md5($_post['password']); //check see if username exists $sql = mysql_query("select username usersystem username = '".$username."'"); if(mysql_num_rows($s?>0)) { die("username taken."); } mysql_query("insert usersystem (username, password, email) values ( '$username', '$password', '$email')") or die (mysql_error()); echo "account created."); } ?>
i not understand error because there not ';' @ end of line.
if (mysql_num_rows($s?>0))
should be
if (mysql_num_rows($sql) > 0)
and....
die (mysql_error()); echo "account created.";)
should
die (mysql_error()); echo "account created.";
Comments
Post a Comment