#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    2
    Rep Power
    0
    I am really new to this but I am trying: Please don't make fun of me.....
    So when I try to run a script with that starts with a function:
    function useColor()
    or
    function printCity ($NameOfCity)
    I get this error:
    Parse error: parse error in /home/sdavis/ public_html/static_var.php3 on line 1
    Can anyone point me in the right direction....
    Sorry to bug you guys...I know this is probably pretty silly.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    14
    Rep Power
    0
    Is this code actually going through the PHP parser?
    <?php
    //your code
    ?>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    London
    Posts
    46
    Rep Power
    15
    if you want to do a little thing like this then you write the function first and then you call it after.

    ie:

    <?
    function printcity($cityname)
    {
    print("City name is: $cityname");
    }

    $mycity = "London";
    printcity($mycity);
    ?>

    Laterz,

    Kelvin

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by shannon:
    I am really new to this but I am trying: Please don't make fun of me.....
    So when I try to run a script with that starts with a function:
    function useColor()
    or
    function printCity ($NameOfCity)
    I get this error:
    Parse error: parse error in /home/sdavis/ public_html/static_var.php3 on line 1
    Can anyone point me in the right direction....
    Sorry to bug you guys...I know this is probably pretty silly.
    [/quote]

  6. #4
  7. No Profile Picture
    Dave Bryant
    Guest
    Devshed Newbie (0 - 499 posts)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by shannon:
    I am really new to this but I am trying: Please don't make fun of me.....
    So when I try to run a script with that starts with a function:
    function useColor()
    or
    function printCity ($NameOfCity)
    I get this error:
    Parse error: parse error in /home/sdavis/ public_html/static_var.php3 on line 1
    Can anyone point me in the right direction....
    Sorry to bug you guys...I know this is probably pretty silly.
    [/quote]

    Well if you get an error on line 1 something is basically wrong with the script. Possibly, and I did this my first time, was to put a carriage return before the very first <?php and this blew up the parser.

    Also, make sure you have function thisismyfunction ($var) {
    }
    The {} are very important for the script to recognize the function.

    ------------------
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    2
    Rep Power
    0
    YEA releasedj!!!!! It worked!!! Thanks!

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by releasedj:
    if you want to do a little thing like this then you write the function first and then you call it after.

    ie:

    <?
    function printcity($cityname)
    {
    print("City name is: $cityname");
    }

    $mycity = "London";
    printcity($mycity);
    ?>

    Laterz,

    Kelvin

    [/quote]


IMN logo majestic logo threadwatch logo seochat tools logo