Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9135195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:47:33+00:00 2026-06-17T08:47:33+00:00

Can anyone tell me why PHP is igving me this error?: Parse error: syntax

  • 0

Can anyone tell me why PHP is igving me this error?:

Parse error: syntax error, unexpected 'else' (T_ELSE) in C:\xampp\htdocs\Task2PHP\final\registration.php on line 139

(error is the one in * since I didn’t output all the code)

I can’t seem to find the problem

Code:

<?php

if ($isLoggedin === false) {

                                include("form.php");


                                    if (isset($_POST['Name'])) {

                                        // DECLARE VARIABLES TO NULL
                                        $Name = null; $Surname = null; $Username = null; $Email = null; $C_Email = null; $Password = null; $C_Password = null; $SecQ = null; $SecA = null;

                                        // GET ELEMENTS FROM BROWSER POST.
                                        if (isset($_POST['Name'])) {
                                            $Name = $_POST['Name'];
                                        }
                                        if (isset($_POST['Surname'])) {
                                            $Surname = $_POST['Surname'];
                                        }
                                        if (isset($_POST['Username'])) {
                                            $Username = $_POST['Username'];
                                        }
                                        if (isset($_POST['Email'])) {
                                            $Email = $_POST['Email'];
                                        }
                                        if (isset($_POST['C_Email'])) {
                                            $C_Email = $_POST['C_Email'];
                                        }
                                        if (isset($_POST['password'])) {
                                            $Password = $_POST['password'];
                                        }
                                        if (isset($_POST['c_password'])) {
                                            $C_Password = $_POST['c_password'];
                                        }
                                        if (isset($_POST['SecQ'])) {
                                            $SecQ = $_POST['SecQ'];
                                        }
                                        if (isset($_POST['SecA'])) {
                                            $SecA = $_POST['SecA'];
                                        }

                                        // CONNECT TO MYSQL DB
                                        $con = mysql_connect('localhost', 'storefileuser', 'storefileuser');
                                        mysql_select_db ("storefile");


                                        if (!$con) {

                                                die('Could not connect: ' . mysql_error());
                                            } else {

                                                if ($Name == null || $Surname== null || $Password == null || $C_Password == null || $Email == null || $C_Email == null || $SecQ == null || $SecA == null ) {
                                                    echo "Missing details. Please enter all fields.";
                                                } else {

                                                    $usernameexists = false;
                                                    $emailexists = false;
                                                    $result = mysql_query("SELECT * FROM users WHERE username = '$Username'");
                                                    if (mysql_num_rows($result) > 0) {
                                                        $usernameexists = true;
                                                    }
                                                    $result = mysql_query("SELECT * FROM users WHERE Email = '$Email'");
                                                    if (mysql_num_rows($result) > 0) {
                                                        $emailexists = true;
                                                    }

                                                    if (!$emailexists || !$usernameexists) { 
                                                        // VALIDATE CONFIRMS
                                                        if  ($Email == $C_Email && $Password == $C_Password) {

                                                            $encrypt_password=md5($Password);

                                                            $query = "INSERT INTO users (Username, Name,Surname, Password, Email, SecQ, SecA) VALUES ('".$Username."', '".$Name."', '".$Surname."', '".$encrypt_password."', '".$SecQ."', '".$SecA."', '".$Email."')";


                                                            echo "You have been successfully registered.";


                                                            }

                                                        } else {
                                                            echo "Error registering.";


                                                    } else {
                                                        echo "Username or email already entered in the database!";
                                                    }
                                                }
                                        }

                                    } 






    }   else {

            echo '<h1> You are already registered/logged in!</h1>';


            }                               
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:47:33+00:00Added an answer on June 17, 2026 at 8:47 am
        echo "You have been successfully registered.";
    
    '}'
    
    } else {
        echo "Error registering.";
    }
    

    That’s the problem. The bracket I put in quotes.

    I strongly advise you to use a IDE designed for PHP (like Eclipse PDT for example). It will show you exactly were the problem is with your syntax.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone tell me whats wrong with this code? <?php $feedID = '28241415'; $oddsArray
Can anyone tell me what's wrong with this php snippet? I'm trying to integrate
Can anyone tell me why this doesn't work? <?php $lang = $_get[lang]; if (($lang
Can anyone tell me what is wrong with this code block? The PHP compiler
Can anyone tell me why am I getting this error when running app/console in
I Found this embedded in a php file on my site, can anyone tell
Can anyone tell me if its possible to validate a link with php? By
Can anyone tell why my jQuery script is not loading here <?php wp_enqueue_script(jquery); ?>
Can anyone tell me what is holding us back. I tried every different php
Can anyone tell me what is happening here? <?php // true var_dump('\\ ' ===

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.