Problem with my code. Parse error

Discussion in 'PHP' started by harlequeen, May 7, 2006.

  1. #1
    I am trying to call a record from a db so that I can amend it in a form. I keep getting the following message:

    Parse error: parse error in /chroot/home/TM340484/public_html/blog/editentry3.php on line 42

    Line 42 is the end of my page.

    The variable is being passed to the receiving page, but I can't see what the error is in my code. I have pared the code to just two fields to try to narrow it down, but can't get it. I'm a beginner at this so could do with some help.

    
    
    <?php
    //queries the database using the variable value
    $amendarticle = mysql_query("SELECT * FROM article WHERE article_id='$article_id'" )or die(mysql_error());
    //Tests that there is a result from the query(amendarticle) and outputs to screen
    
    while ($myrow = mysql_fetch_array($amendarticle)) 
    
    {
    mysql_close();
    ?>
    
    
    <form name="getentry" action="editentry.php" method="get"  target="_self">
    
    <input type="hidden" name="article_id"  value="<? echo $myrow["article_id"]; ?>"><? echo $myrow["article_id"]; ?><br>
     
    <input type="text" name="article_title"  size="60" maxlength="60" value="<? echo $myrow["article_title"]; ?>"><br>
    
    
    
    <input type="reset" value="Clear" name="reset"><br>
    <input type="submit" value="Submit" name="submit"  ><br>
    
    
    </form>
    Code (markup):
    If anyone could help I would be grateful. I can't do the next bit until I can see that I can recall a record.

    Thanks for your help
     
    harlequeen, May 7, 2006 IP
  2. dct

    dct Finder of cool gadgets

    Messages:
    3,132
    Likes Received:
    328
    Best Answers:
    0
    Trophy Points:
    230
    #2
    If that's all of you code the first problem is you are not opening the first php tag, all you php sections should begin with <?php (<? will work but <?php is more obvious IMO)
     
    dct, May 7, 2006 IP
  3. harlequeen

    harlequeen Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sorry, I missed the opening tag from the code posted, but it is there. Even when I changed the <? to <?php I still get the same problem. I am not familiar enough with php to see what is wrong.

    Any further ideas?
     
    harlequeen, May 7, 2006 IP
  4. JRJR

    JRJR Active Member

    Messages:
    172
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    I think you've missed the closing of the loop.

    <?php
    }
    ?>
     
    JRJR, May 7, 2006 IP
  5. harlequeen

    harlequeen Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks JRJR, I had just noticed it, then checked here to tell everyone, and you had already provided the answer.

    Thanks
     
    harlequeen, May 7, 2006 IP
  6. JRJR

    JRJR Active Member

    Messages:
    172
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #6
    Cool. If you have anymore problem shoot it here. :D
     
    JRJR, May 7, 2006 IP