SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there,

    I know that this isn't too good to do this, but I have been trying to figure out this bug for hours and hours and I absolutely cannot figure it out.

    I have a PHP script that you can see the source of here:
    http://cgi-bin.spaceports.com/~fatpi...board.php3.txt

    I keep on getting this error:

    Parse error: parse error in /home2/fatpiper/public_html/php/board.php3 on line 168

    Now, the code for line 168 is simply a closing } for a function, so I assume that's not the problem. The line above it, the return function, is fine and dandy. So I really can't figure it out.

    For those who are lazy to check out the URL above, this is the concerned function:

    PHP Code:
    // shows the message that has id $ID
    function showmessage($ID){
        global 
    $templates,$db;
        
    $query"SELECT * FROM ".$db["table"]." ".
            
    "WHERE ID='$ID'";
        if(!
    $result=mysql_query($query,$db["link"])){ 
                      print 
    "Kaput because ".mysql_error()." in function showmessage with query $query"; }
        while(
    $row=mysql_fetch_object($result)){
            
    $html replacer($row->poster,$row->email,date("d/m/Y Hi",$row->created),$row->$title,NULL,$row->message,NULL,openhtml($templates["message"]));
            
    $html .= ereg_replace("_REPLIES_","<br>".show($row->ID)."</br>",$html);
            
    $html ereg_replace("_FORM_",showform($row->ID,$row->title),$html);
            }
        }
        return 
    $html;

    The last line of that snippet is 168, the problem line.

    A bit of background: This function was working fine until a little while ago, until I added an admin function (this is a message board btw ... yes, yet another). I didn't change it at all, but all of a sudden, it gives me this parse error.


    Please, I beg you, help if you can before I recarpet my floor with gray, torn-out hairs!

    Thanks a lot for any clues..
    Dan

    ... what's the world coming to?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am pretty sure the problem is that your return $html line is outside the function or you have one too many closing brackets, the bottom one should come off and the return line should move above the last closign bracket like:
    PHP Code:
    function showmessage($ID){
        global 
    $templates,$db;
        
    $query"SELECT * FROM ".$db["table"]." WHERE ID='$ID'";
        if(!
    $result=mysql_query($query,$db["link"])) { 
            print 
    "Kaput because ".mysql_error()." in function showmessage with query $query"
            }
        while(
    $row=mysql_fetch_object($result)){
            
    $html replacer($row->poster,$row->email,date("d/m/Y Hi",$row->created),$row->$title,NULL,$row->message,NULL,openhtml($templates["message"]));
            
    $html .= ereg_replace("_REPLIES_","<br>".show($row->ID)."</br>",$html);
            
    $html ereg_replace("_FORM_",showform($row->ID,$row->title),$html);
            }
        return 
    $html;
        } 
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much you are a genius!!! You don't know how much hair I have pulled out over that (recarpeting my flat wasn't a joke ...)
    Finally the dang thing works!
    To see the fruit of your labor, you can check this out if you wish (noone's there though, its just my first real php progging attempt..)
    http://cgi-bin.spaceports.com/~fatpi...ntfile=discuss

    --UPDATE: Don't check it out, the script is all buggy and messy, showing the message twice each time ... yuk ..

    Thanks again and again and again !!!
    Dan
    *twirls around and faints, happily sighing, seeing life in full rosy glory*
    ahem.
    Last edited by FatPiper; Feb 25, 2001 at 15:57.

    ... what's the world coming to?

  4. #4
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freddy must be smiling now You are fast Freddy!
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy


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
  •