Jump to content

Parse error: syntax error, unexpected ';' in C:\Users\User\l\htdocs\register.php on line 7


dean012

Recommended Posts


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>

 

i repaired the problem now i got this

Parse errorsyntaxarrow-10x10.png error, unexpected 'mysqli_query' (T_STRING) in C:\Users\User\l\htdocs\registerarrow-10x10.png.php on linearrow-10x10.png 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!":
	

i just fixed it 

now i got this Parse error: syntax error, unexpected end of filearrow-10x10.png in C:\Users\User\l\htdocs\registerarrow-10x10.png.php on linearrow-10x10.png 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>

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
?>    

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 "";

}
?>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.