0

(Coding PHP with MySQL)

Fatal error: Cannot redeclare logged_in() (previously declared in C:\xampp\htdocs\Project\Func\user.func.php:9) in C:\xampp\htdocs\Project\Func\user.func.php on line 9

I'm making a function to check if a user is logged in. I declare the function as logged_in() {}, but the function causes the error seen above, even though I've never declared it before.

The function didn't work when it was defined either, with an isset and a reference to MySQL code.

NorS
  • 168
  • 3
  • 14
Nors
  • 3
  • 2

2 Answers2

4

even though I've never declared it before?

It must have been declared previously somewhere.

Maybe you are including user.func.php twice?

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
0

If you can't work out whether you've declared it before, use this function in a separate test class. It'll identify how many times you've called the function.

If it says it's being called before, download a search program like grepWin and search your public_html folder for the file that's hosting your rogue function.

Community
  • 1
  • 1
hohner
  • 11,498
  • 8
  • 49
  • 84