dean012 Posted November 28, 2013 Share Posted November 28, 2013 Parse error: syntax error, unexpected ';' in C:\Users\User\l\htdocs\register.php on line 7 <html> <body> <?php include("connect.php"); if(isset($_POST['register']));{ $username= strip_tags(trim(mysql_real_ecape_string($_POST['username'])); $password= strip_tags(trim(mysql_real_ecape_string($_POST['password'])); if(!username || !$password){ echo "One of the fields are empty"; }else{ $find_multiple=" SELECT Username FROM register WHERE Username='$username' "; $run_multiple = mysql_query($find_multiple) or die (mysql_error()); $num_multiple= mysql_num_rows($run_multiple); if($num_multiple < 1){ $password= md5($password) mysql_query("INSERT INTO register SET Username='$Username', Password='$Pasword'")or die(mysql_error()); echo "You have succesfully registered!": }else{ echo "That username has already beed used" ; } ?> }else{ echo" <h1>Register</h1> <form action='' method='post'> username: <input type='text' name'username'/></br> Password: <input type='password' name'password'/></br> <input type='submit' value='Register'name='register'/> </form> Link to comment https://forums.phpfreaks.com/topic/284349-parse-error-syntax-error-unexpected-in-cusersuserlhtdocsregisterphp-on-line-7/ Share on other sites More sharing options...
dean012 Posted November 28, 2013 Author Share Posted November 28, 2013 i repaired the problem now i got this Parse error: syntax error, unexpected 'mysqli_query' (T_STRING) in C:\Users\User\l\htdocs\register.php on line 20 and i tried if($num_multiple < 1){ $password= md5($password) mysql_query("INSERT INTO register SET Username='$Username', Password='$Pasword'") die(mysql_error()); echo "You have succesfully registered!": Link to comment https://forums.phpfreaks.com/topic/284349-parse-error-syntax-error-unexpected-in-cusersuserlhtdocsregisterphp-on-line-7/#findComment-1460475 Share on other sites More sharing options...
dean012 Posted November 28, 2013 Author Share Posted November 28, 2013 i just fixed it now i got this Parse error: syntax error, unexpected end of file in C:\Users\User\l\htdocs\register.php on line 41 <html> <body> <?php include("connect.php"); if(isset($_POST['register'])) $username= strip_tags(trim(mysql_real_ecape_string($_POST['username']))); $password= strip_tags(trim(mysql_real_ecape_string($_POST['password']))); if(!username || !$password){ echo "One of the fields are empty"; }else{ $find_multiple=" SELECT Username FROM register WHERE Username='$username' "; $run_multiple = mysql_query($find_multiple) or die (mysql_error()); $num_multiple= mysql_num_rows($run_multiple); if($num_multiple < 1){ $password= md5($password); mysql_query("INSERT INTO register SET Username='$Username', Password='$Pasword' ") or die(mysql_error()); echo "You have succesfully registered!"; }else{ echo "That username has already beed used" ; } ?> <head> <h1>Register</h1> <form action='' method='post'> username: <input type='text' name'username'/></br> Password: <input type='password' name'password'/></br> <input type='submit' value='Register'name='register'/> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/284349-parse-error-syntax-error-unexpected-in-cusersuserlhtdocsregisterphp-on-line-7/#findComment-1460479 Share on other sites More sharing options...
objnoob Posted November 28, 2013 Share Posted November 28, 2013 You're not opening nor closing your if statements. if(isset($_POST['register'])){ $username= strip_tags(trim(mysql_real_ecape_string($_POST['username']))); $password= strip_tags(trim(mysql_real_ecape_string($_POST['password']))); if(!username || !$password){ echo "One of the fields are empty"; }else{ $find_multiple=" SELECT Username FROM register WHERE Username='$username' "; $run_multiple = mysql_query($find_multiple) or die (mysql_error()); $num_multiple= mysql_num_rows($run_multiple); if($num_multiple < 1){ $password= md5($password); mysql_query("INSERT INTO register SET Username='$Username', Password='$Pasword' ") or die(mysql_error()); echo "You have succesfully registered!"; }else{ echo "That username has already beed used" ; } } # endelse: empty password or username } # endif: registered ?> Link to comment https://forums.phpfreaks.com/topic/284349-parse-error-syntax-error-unexpected-in-cusersuserlhtdocsregisterphp-on-line-7/#findComment-1460487 Share on other sites More sharing options...
dean012 Posted November 28, 2013 Author Share Posted November 28, 2013 Fatal error: Call to undefined function mysql_real_ecape_string() in C:\Users\User\l\htdocs\register.php on line 7 <?php // Connecting to a MySQL Database. $connect= mysql_connect('localhost','root',''); $db = mysql_select_db('users'); if($connect && $db){ echo "Its working."; }else{ $connect= $connect or die (mysql_error()); $db= $db or die (mysql_error()); echo ""; } ?> Link to comment https://forums.phpfreaks.com/topic/284349-parse-error-syntax-error-unexpected-in-cusersuserlhtdocsregisterphp-on-line-7/#findComment-1460492 Share on other sites More sharing options...
Ch0cu3r Posted November 28, 2013 Share Posted November 28, 2013 If you are getting this error Fatal error: Call to undefined function mysql_real_ecape_string() in C:\Users\User\l\htdocs\register.php on line 7 Then you have spelt the function wrong. it is called mysql_real_escape_string Link to comment https://forums.phpfreaks.com/topic/284349-parse-error-syntax-error-unexpected-in-cusersuserlhtdocsregisterphp-on-line-7/#findComment-1460502 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.