I have a php script dat is suposse to register users into a database. but first I want it to check d user password with a pin code in the data base and the user password and my db pin match den we add the user details to the database else we echo an error but I dont seem to be getting it. please help me dis d php script
`
$connect=mysql_connect("$host","$user","$password")
or die("Bross why na, change the localhost to example site.com without www. ");
$select=mysql_select_db("$db_name")
or die("dagogo change the db");
//collection data from registration form and processing encrypting it
$first_name=($_POST["First_Name"]);//user 1st name
$last_name=($_POST["Last_Name"]);//user last name
$username=($_POST["UserName"]);//user special User name
$phone=($_POST["Phone"]);//user phone number
$email=($_POST["email"]);//user email address
$password=($_POST["password"]);//user password
//checking the pin with pin in the database
$query=mysql_query("SELECT * FROM pin_code WHERE pin='$password'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row =mysql_fetch_assoc($query))
{
$dbpassword=$row['pin'];
}
if($password==$dbpassword)
{
//inserting the form details into the database.
mysql_query("INSERT INTO users(first_name,last_name,username,phone,email,password)VALUES('$first_name','$last_name','$username','$phone','$email','$password')")or die ("Registration failed");
}
else
{
echo"dagogo";
}
`
and kip on get this error Parse error: parse error in C:\wamp\www\9ja School Solutionegister.php on line 114
wic hapenns to be d last line of d script"?>" please help
The Error Was You didn't Close the First If Statement No closing Bracket for it (})
Try the following..
$connect=mysql_connect("$host","$user","$password")
or die("Bross why na, change the localhost to example site.com without www. ");
$select=mysql_select_db("$db_name")
or die("dagogo change the db");
//collection data from registration form and processing encrypting it
$first_name=($_POST["First_Name"]);//user 1st name
$last_name=($_POST["Last_Name"]);//user last name
$username=($_POST["UserName"]);//user special User name
$phone=($_POST["Phone"]);//user phone number
$email=($_POST["email"]);//user email address
$password=($_POST["password"]);//user password
//checking the pin with pin in the database
$query=mysql_query("SELECT * FROM pin_code WHERE pin='$password'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row =mysql_fetch_assoc($query))
{
$dbpassword=$row['pin'];
}
if($password==$dbpassword)
{
//inserting the form details into the database.
mysql_query("INSERT INTO users(first_name,last_name,username,phone,email,password)VALUES('$first_name','$last_name','$username','$phone','$email','$password')")or die ("Registration failed");
}
else
{
echo"dagogo";
}
}