SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm getting a weird error:

    Fatal error: Cannot redeclare link() in ../somefile.php on line 123

    The file this error is occuring in is a file full of functions my pages are making use of.

    The line the error is listed on is the first line of this function.

    Code:
            function link($text,$url) {
                echo("<b><a href=\"$url\">$text</a></b>");
            }
    Any idea what's wrong? I can't even figure out what the error message means. As you can see, the function is very simple and is just there to save me some time...instead of typing this...

    echo("<b><a href=\"page.html">Go To Page</a></b>");

    ...I can just type this...

    link("Go To Page", "page.html");

    Any help is appreciated!

  2. #2
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    link() is a php function. try renaming your function.


  3. #3
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, function works now.

    I don't understand, however, how to use the link() function...I tried this...

    echo(link("page.html", "Link Text Here"));

    ...and got this error:

    Warning: Unable to link to a URL in /path/to/file.php on line 3

    ...any ideas?

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    link() runs a system command on unix machine that creates a soft link from one file to another, it isn't the same as a link in html. like when you put a link in the rc.d folder for cron jobs you use ln -s ../init.d/mysql.server /etc/rc.d/rc3.d/mysql

    That is what type of link you are creating.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I semi-understand. I understand enough to see why it's not working, at least. Thanks Freddy.


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
  •