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 785275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:51:03+00:00 2026-05-14T20:51:03+00:00

I’m having trouble with this error in php: Parse error: syntax error, unexpected $end

  • 0

I’m having trouble with this error in php:

 Parse error: syntax error, unexpected $end in J:\Server\xampplite\htdocs\exp\printact.php  on line 172

It might be a lack of bracket or something. Is there any tool that could help me pin point where exactly the error is?

EDIT:
Here’s the code, its a mess:)

<link rel="stylesheet" href="print.css" type="text/css" media="print" />

<font size="3"><center><b>XD627 INFORMATION MANAGEMENT SYSTEM</b></center></font>

<br />
<br />

<div id="max">






    <?php
$con = mysql_connect("localhost","root","nitoryolai123$%^");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("school", $con);
?> 



<?php 

$ShowImage= ( $_POST['pic'] == 'pix');


$ShowFirstName = ( $_POST['fname'] == 'firstname');

$ShowLastName = ( $_POST['lname'] == 'lastname');

$ShowMidName = (  $_POST['mname'] == 'midname');

$ShowAddress = (  $_POST['ad'] == 'address');

$ShowGender = ( $_POST['gender'] == 'gen');


$ShowReligion = (  $_POST['rel'] == 'religion');

$ShowBday = (   $_POST['bday'] == 'birthday');

$ShowContact = (   $_POST['contact'] == 'contactnum');

$ShowMother = (   $_POST['mother'] == 'ma');

$ShowMotherOcc = (  $_POST['mother_occ'] == 'ma_occ');

$ShowFather = (   $_POST['father'] == 'pa');

$ShowFather_Occ = (  $_POST['father_occ'] == 'pa_occ');

$ShowParentAddress = (  $_POST['parent_add'] == 'pad');


$ShowParentContact = (  $_POST['parent_contact'] == 'pcon');

$id =  mysql_real_escape_string($_POST['idnum']); 
$result2 = mysql_query("SELECT * FROM student WHERE IDNO='$id'"); 
$result3 = mysql_query("SELECT * FROM mother WHERE IDNO='$id'");
$result4 = mysql_query("SELECT * FROM father WHERE IDNO='$id'");
$result5 = mysql_query("SELECT * FROM parents WHERE IDNO='$id'");
?>

<?php while($row = mysql_fetch_array($result2)) 
{ 
?>

<font size="2"><b><u>Student Information</br></b></u></font><br>

<?php if( $ShowImage ) ?> 
 <?php echo "<img src='http://localhost/exp/upload/$sidno.jpg'>"; ?> <br><br>

  <font size="1"><B>ID Number:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['IDNO']; ?> &nbsp;&nbsp;&nbsp;<br>

  <font size="1"><B><B>Year:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['YEAR']; ?> &nbsp;&nbsp;&nbsp; <br>
     <B>Section:</B>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['SECTION']; ?> &nbsp;&nbsp;&nbsp;<br>


<?php if( $ShowLastName ) ?>
  <font size="1"><B>Lastname:</B>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['LASTNAME']; ?>&nbsp;&nbsp;&nbsp;<br>

  <?php   if( $ShowFirstName ) ?>
         <font size="1"><B><B>Firstname:</B>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['FIRSTNAME']; ?> &nbsp;&nbsp;&nbsp;<br>

 <?php if( $ShowMidName ) ?>
         <font size="1"><B><B>Midname:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['MI']; ?> &nbsp;&nbsp;&nbsp;<br>


    <?php if( $ShowAddress ) ?>
         <font size="1"><B><B>Address:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['ADDRESS']; ?> &nbsp;&nbsp;&nbsp;<br>


    <?php if( $ShowGender ) ?>
         <font size="1"><B><B>Gender:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['GENDER']; ?> &nbsp;&nbsp;&nbsp;<br>




    <?php if( $ShowReligion ) ?>
         <font size="1"><B><B>Religion:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['RELIGION']; ?> &nbsp;&nbsp;&nbsp;<br>


    <?php if( $ShowBday ) ?>
         <font size="1"><B><B>Birthday:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['BIRTHDAY']; ?> &nbsp;&nbsp;&nbsp;<br>


    <?php if( $ShowContact) ?>
         <font size="1"><B><B>Contact Number</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['S_CONTACTNUM']; ?> &nbsp;&nbsp;&nbsp;<br>


<?php } ?>


<?php while($row = mysql_fetch_array($result3)) 
{ 
?>
  <br>
<br>
 <?php if( $ShowMother or $ShowFather or $ShowMotherOcc or $ShowFather_Occ  or $ShowParentAddress or $ShowParentContact ) ?>

<font size="3"><b><u>Parent Information</br></b></u></font><br>


   <tr>
     <?php  if( $ShowMother ) ?>

         <font size="1"><B><B>Mother:</B>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['MOTHER']; ?>&nbsp;&nbsp;&nbsp;<br>


    <?php     if( $ShowMotherOcc ) ?>
         <font size="1"><B><B>Mother Occupation:</B>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['MOTHER_OCCUPATION']; ?>&nbsp;&nbsp;&nbsp;<br>
}


<?php  while($row = mysql_fetch_array($result4)) 
{  ?>

        <?php   if( $ShowFather ) ?>
         <font size="1"><B><B>Father:</B>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['FATHER']; ?> &nbsp;&nbsp;&nbsp;<br>

         <?php  if( $ShowFather_Occ ) ?>
         <font size="1"><B><B>Father Occupation:</B>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['FATHER_OCCUPATION']; ?>&nbsp;&nbsp;&nbsp;<br>

<?php } ?>
<?php while($row = mysql_fetch_array($result5)) 
{ ?>
        <?php   if( $ShowParentAddress ) ?>
         <font size="1"><B><B>Parent Address:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['P_ADDRESS']; ?> &nbsp;&nbsp;&nbsp;<br>


         <?php    if( $ShowParentContact ) ?>
         <font size="1"><B><B>Parent Contact:</B>&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $row['P_CONTACTNUM']; ?> &nbsp;&nbsp;&nbsp;<br>


<?php } ?> 


<?php mysql_close($con);  ?> 
</div>
<div id="nav">
<form>
<input type="button" value="Print" onClick="window.print();" /> 
</form>
</div>
  • 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-05-14T20:51:03+00:00Added an answer on May 14, 2026 at 8:51 pm
    while ($row = mysql_fetch_array($result3)) {
    

    This loop is never closed.

    Here’s the method I used to find the issue:

    1. Went to http://www.phpformatter.com/ and copy-pasted the code you supplied into the box.
    2. Checked the “Comment after control structures” box under “Options”.
    3. Had it format the code.
    4. Went through and looked for the structure that didn’t have a matching end comment.

    It’s not fully automated by far, but having the comments after each closing brace to tell you what the parser believes is matching with that brace is a godsend for tracking down missing/mismatched braces.

    In the future, however, I highly recommend trying to format/comment your code neatly in the first place – it helps to both find and avoid these kinds of errors.

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

Sidebar

Ask A Question

Stats

  • Questions 479k
  • Answers 479k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Regular expressions can't calculate, so you can't do this with… May 16, 2026 at 5:56 am
  • Editorial Team
    Editorial Team added an answer Instead of cracking my head over a regex (URLs are… May 16, 2026 at 5:56 am
  • Editorial Team
    Editorial Team added an answer The solution was actually pretty simple, but it took me… May 16, 2026 at 5:56 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.