Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP syntax error: unexpected end of file

Posted on 2014-11-26
8
Medium Priority
?
223 Views
Last Modified: 2015-04-16
I modified a module on one of my OpenCart (v1.5.5.1) sites and it works fine, I copied those changes to another site and in one template file I have the following code line:
<?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { ?>

Open in new window

Which generates a "syntax error: unexpected end of file on line 162" which is the end of the template file
<?php } ?>

Open in new window

.
I don't understand why I have the error, I'd appreciate any help.
0
Comment
Question by:stoneycurtis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 40466594
You have a { starting a block, with no matching } ending it.
0
 

Author Comment

by:stoneycurtis
ID: 40466751
Hello ozo,
Adding the closing bracket:
<?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { }  ?>

Open in new window

Breaks the page.
Deleting the opening bracket:
<?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE)  ?>

Open in new window

Breaks the page.
How would I add the closing bracket?
0
 
LVL 84

Expert Comment

by:ozo
ID: 40466763
In what way does the page break?
What if you remove the entire line?
0
Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

 

Author Comment

by:stoneycurtis
ID: 40466794
Ozo,
By page break I mean the page returns a blank white screen.
Here is the entire code snippet:
<?php $i = 0; ?>
    <?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { ?>    
                <tr>
                    <td class="simplecheckout-customer-left">                       
                    </td>                    
<td class="simplecheckout-customer-right">  
                      <label><input type="radio" name="register" id="myRadio" value="1" <?php echo $register == 1 ? 'checked="checked"' : ''; ?>reload="customer_register" /><b><?php echo $text_yes ?></b>&nbsp;<b><?php echo $text_register; ?></b>&nbsp;</label></br>
                      <p><?php echo $text_register_account; ?></p>
                     <label><input type="radio" name="register" id="myRadio2" value="0"  <?php echo $register == 0 ? 'checked="checked"' : ''; ?>reload="customer_not_register" /><b><?php echo $text_no ?>&nbsp;<?php echo $text_guest; ?></b></label>
                    
                  </td> 
          </tr> 
               <?php $user_choice = true; ?>
            <?php $i++ ?>           
                   

Open in new window

The code determines if a user is already logged in to his account.
What if I placed
<?php ?>

Open in new window

after
<?php $i++ ?>

Open in new window

0
 
LVL 84

Expert Comment

by:ozo
ID: 40466820
If the entire code is
<?php $i = 0; ?>
    <?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { ?>    
                <tr>
                    <td class="simplecheckout-customer-left">                       
                    </td>                    
<td class="simplecheckout-customer-right">  
                      <label><input type="radio" name="register" id="myRadio" value="1" <?php echo $register == 1 ? 'checked="checked"' : ''; ?>reload="customer_register" /><b><?php echo $text_yes ?></b>&nbsp;<b><?php echo $text_register; ?></b>&nbsp;</label></br>
                      <p><?php echo $text_register_account; ?></p>
                     <label><input type="radio" name="register" id="myRadio2" value="0"  <?php echo $register == 0 ? 'checked="checked"' : ''; ?>reload="customer_not_register" /><b><?php echo $text_no ?>&nbsp;<?php echo $text_guest; ?></b></label>
                    
                  </td> 
          </tr> 
               <?php $user_choice = true; ?>
            <?php $i++ ?>           
<?php } ?>

Open in new window

Then I get no syntax error, just a "Class 'Simple' not found" error
0
 

Author Comment

by:stoneycurtis
ID: 40466851
The code is part of a larger file, I've attached it.
0
 
LVL 1

Accepted Solution

by:
Rani Sharda earned 2000 total points
ID: 40468353
What I can see is missing semicolon (;) after the statement -
<?php $i++ ?>

It should be -
<?php $i++; ?>
0
 
LVL 84

Expert Comment

by:ozo
ID: 40469827
I don't see an attachment
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seveā€¦

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question