Jump to content

Recommended Posts

I have had majour problems with my easyspace website. I beleive the servers were not updating over the weekend. I am now told that the reason for the error is on a line that should not be reached. I put a hello world and an exit at the verry top of the code.

Can soneone tell me what is wrong with line 183 please [<?php if($MM > '10') {?>]

After I spoke to them this morning the page says

Parse error: Unclosed '{' on line 183 in /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/DataInput.php on line 236

But there is no line 236.

Test.txt

Edited by Paul-D
Link to comment
https://forums.phpfreaks.com/topic/317529-unusual-error/
Share on other sites

A good way of thinking (in the coding world) is to leave a space between things to avoid any confusion as to where the previous 'thing' ends and the next 'thing' begins. So joining the php start tag and brace (<?php}) presents some confusion which you can avoid by using a simple space char

Link to comment
https://forums.phpfreaks.com/topic/317529-unusual-error/#findComment-1613485
Share on other sites

Well I have done exactly as you sugest but this is still not happy. The problem is around a <select> </select> on lines 111 to 123

Error: Parse error: Unclosed '{' on line 122 in /vhost/d/e/s/desmond-otoole.co.uk/www/bank2/StatementEntry.php on line 191. I can not see any issues as there is definatly spaces here. There is .htaccess with the lines

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
 

phpTest.txt

Link to comment
https://forums.phpfreaks.com/topic/317529-unusual-error/#findComment-1613489
Share on other sites

P.S. Your main problem is the spaghetti coding style you are using, continually moving in and out of php within the html. Try keeping them as separate as possible with php first then the html section.

So something like...

<?php

    function yearEntryOptions($current)
    {
        $CurrentMonth = date('n');
        $opts = '';
        
        for ($i = -1; $i <= 1; $i++)   {
            $y = date('Y') + $i;
            $sel = $current == $y ? 'selected' : '';
            $dis = ($CurrentMonth != 1 && $i == -1) || ($CurrentMonth <= 10 && $i == 1) ? 'disabled' : '';
            $opts .= "<option $sel value='$y' $dis>$y</option>\n";
        }
        return $opts;
    }

?>
<html>
  <body>
    
    <select name="YYYY_Entry" style="width:60px">
        <?= yearEntryOptions($SE_YYYY_Entry) ?>
    </select>

  </body>    
</html>

 

  • Like 1
Link to comment
https://forums.phpfreaks.com/topic/317529-unusual-error/#findComment-1613498
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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