Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011

    Unanswered: PHP $parse error

    Hi all

    I have been working on the application for 3 hrs now. I know I have an error but cannot find it. A fresh set of eyes would be greatly appreciated.

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    line 53 mysql_close($connect) appears outside the the function login_do
    line 203..205 you have an if statement followed by and end / start php tags followed by an else statement
    line 214 <?php}?>
    line 192 you have a while statement followed by an ?>, some html then <?php, I don't know if this is valid, but it doesn't look right to me
    line 384 you have a while statement followed by an end brace with no code to process the while loop

    if you get yourself a decent PHP editor these errors would be easily spotted. I used netbeans with the PHP extensions to spot these (well TBH to look where netbeans spotted problems)

    I think part of your problem is the style you are using to write the code. Its not the easiest to use. some people recommend using a framework such as smarty to separate the PHP from the HTML.

    what I tend to do is create a variable and 'dump' the text into that variable, but in any event the idea is to stop jumping in and out of PHP

    there is no need to terminate php between each code block (ferinstance you encapsulate each function with php tags (<?php; ?>), there is no need to do so if as soon as you terminate a php block if the next line starts a new php block. see lines 6..8, 54..56, 65..67 and so on

    a suggestion: you need to think about commenting your code so you (or others) can understand the process

    also bear in mind that with the way that code is set up you may also be transmitting other characters eg spaces. granted they may not be an issue with most scripts but you do need to be carefull what you send to the browser.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2011
    Thanks for the assistance I really appreciate an experienced set of eyes looking it over.

    I know the format is kinda weird and I didn't like it but the prof wanted us to use that style because he thinks it's easier to follow. He didn't hold us to it but with the little php experience I have I figured I would follow along.

    The toughest thing for me has been the "<?php do something ?>" then going into html then back into php again. I don't know how many times I jacked that all up.

    I've been using Notepad++ to write with and then run it in the localhost and debug from what error messages I get there.

    Thanks again for the assistance.

    Alcatraz out!

Posting Permissions

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