SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    BOSTON MA
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi all, i keep getting this parse error

    Code:
    Parse error: parse error in /www/bostoncreative/session1.php on line 1
    evertime i try to run this piece of code:

    Code:
    <?php
    session_start();
    
    if (!$phpsessid) {
    
    session_register('font_family');
    session_register('font_size');
    
    } else if ((!$font_family) || ($font_size)) {
    
    session_register('font_family');
    session_register('font_size');
    
    }
    
    if (!$font_family) {
    	$font_family = "sans-serif";
    }
    if (!font_size) {
    	$font_size = "10";
    }
    
    ?>
    
    
    <HTML>
    <HEAD>
    
    
    bla bla bla
    
    
    </BODY>
    </HTML>

    i'm following an example from a book word by word, but i just don't understand why this particular script is getting a parse error.

    the script is in the root directory. i'm able to run other php scritps from there but apparently not this one.

    any clues ????
    . . . chris

  2. #2
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    BOSTON MA
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, yeah i have a clue .....

    one of the else if's was spelled as "else uf".
    i think that accounts for the parse error.
    if i'm wrong, and anybody decides to have their name be associated with this post, let me know.

    thanks
    . . . chris

  3. #3
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could definetly condense that code.
    Here is what I would do:
    Code:
    <?
    session_start();
    if(!$phpsessionid OR session_is_registered("font_family")==FALSE OR session_is_registered("font_size")==FALSE)
    {
            session_register("font_family");
            $font_family = 'font family';
            session_register("font_size");
            $font_size = '12';
    
    }
    ?>
    
    
    
    <?
    echo $font_family; //output 'font family'
    echo $font_size; //output '12'
    ?>
    Hope that helps

  4. #4
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you solve the problem monkey?

    If not try making <?php, <?
    Just a hunch but it might help....

    Oh no now my name is associated with this post arghhhhhhh
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  5. #5
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    BOSTON MA
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    monkey ?!? monkey ?!? what the ...??

    yes the problem got solved, thank you
    it was the "else uf" that was supposed to be an "else if"

    but i like robp's idea too. it simplifies things a bit.

    thanks. thanks you guys.
    . . . chris


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
  •