SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Entering and exiting out of PHP.

    I have a lot of <?php while() { ?>Code<?php } ?> tags and I have been told it can mess things up... particularily in PHP4. My code works wel if I do that in PHP5 but it shows errors in PHP4... is there any way to fix this in the php.ini file without having to the recode everything? Thanks.
    Have a good day.

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think having multiple opening and closing php tags are obvious because we have to work with HTML since we cannot do anything only with PHP. But you can manage the codings by using MVC (separating the PHP code and HTML into different files).

    BTW, Darren884, what is the error that is thrown in PHP 4? If you say the error and show the code that is giving error on then it would be easier to say what is going on wrong or messy.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well the error is:
    Parse error: syntax error, unexpected '}' in /home/deglist/public_html/manage/add_school.php on line 1

    Now before you say anything the server I developed the code on the file worked fine.

    Now when I move it to this server the code will not work. I do not know the error.
    Have a good day.

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code itself says that there is unexpected closing curly brash in your script.

    Can I see the line 1 of code of add_school.php file? Or possible the whole code in that file...?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  5. #5
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Does the closing curly brace need to be on a separate line to '<?php' or '?>'?

  6. #6
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes i also wonder how that happened and possible to have curly brace in the first line. And another wonder according to OP the code is running fine in PHP 5.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  7. #7
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Darren884 View Post
    Well the error is:
    Parse error: syntax error, unexpected '}' in /home/deglist/public_html/manage/add_school.php on line 1

    Now before you say anything the server I developed the code on the file worked fine.

    Now when I move it to this server the code will not work. I do not know the error.

    There are also different setting for php to display errors, so on one server you may not have got an error message, but you may on another server. Is it jus the version that has changed or have you moved to a completely new server/install of php?
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"

  8. #8
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would think that it would have to be something like that since it isn't a notice or warning, but a show stopper error. Otherwise, as mentioned, error_reporting level will be set different from 4 to 5 and that isn't counting any changes made after install to php.ini.

  9. #9
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi guys the complete code is in this thread: http://www.sitepoint.com/forums/showthread.php?t=523319.
    Have a good day.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •