Closed Thread
Results 1 to 3 of 3

Thread: question about a function error

  1. #1
    Sakizen is offline Newbie
    Join Date
    Feb 2010
    Location
    Canada
    Posts
    4
    Rep Power
    0

    question about a function error

    Hey, error that I can't seem to wrap my head around... it doesn't make sense for me.

    I am running PHP 5 and when this is the error it prints:


    Fatal error: Cannot redeclare sanitizeinput() (previously declared in (dir...)\includes\functions.php:3) in (dir...)\includes\functions.php on line 77
    My function, sanitizeInput($string) takes a string, and returns a string variable.

    What I don't understand is that it says on line 77(which is just simply an ending bracket to close the function).
    Another thing that doesn't make sense, is that it says "Cannot redeclare sanitizeinput()" with empty parameters when my function suppose to accept 1 parameter.

    That is all that information that I can think of right now that is relevant, if you should know anymore, please just ask.

    Appreciate any help

    -----------------------------------------------------------------------------------

    I actually found out my problem... Here is the solution if anyone else was having the same issue.

    This error occured for me because I had my functions.php file being included multiple times, causing the script to run into a redeclare error.
    Last edited by Sakizen; 02-17-2010 at 04:00 PM. Reason: Found the solution

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: question about a function error

    A good thing to avoid that, is to use include_once() instead of include(). include_once() will check if the file is included already, and if it is, it just does nothing.
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  4. #3
    Sakizen is offline Newbie
    Join Date
    Feb 2010
    Location
    Canada
    Posts
    4
    Rep Power
    0

    Re: question about a function error

    Quote Originally Posted by Orjan View Post
    A good thing to avoid that, is to use include_once() instead of include(). include_once() will check if the file is included already, and if it is, it just does nothing.
    thanks for the tip.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Error calling function from included file
    By sAuhsoj in forum PHP Development
    Replies: 2
    Last Post: 10-02-2011, 08:55 AM
  2. Replies: 3
    Last Post: 11-12-2010, 05:47 PM
  3. Replies: 1
    Last Post: 07-20-2010, 12:46 PM
  4. Replies: 5
    Last Post: 09-24-2008, 06:45 PM
  5. Replies: 1
    Last Post: 05-27-2008, 09:21 AM

Tags for this Thread

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