Fatal error: Cannot redeclare isitadmin () (previously declared in / home/heart.php:19) in / home / heart.php on line 37

There is an index.php file that includes the heart.php file. In the heart.php there is a function

 function isitadmin() { ...тут идут всякие сравнения кук и бд. ... } 

What could be the problem? Googled, found only what can be a double call to a function. I tried to remove it. Just called the function once and remembered the variable. Still the same problem.

Closed due to the fact that off-topic participants Pavel Mayorov , aleksandr barakin , zRrr , Cerbo , VenZell 4 May '16 at 6:27 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - zRrr, Cerbo, VenZell
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • show the code listing, then you will be shown the specific location of the error. - FLK
  • I have somehow corrected everything) I did not even understand how. Magic .. what else to say - Emil Sabitov
  • 2
    I vote for closing this question as not relevant to the topic, because the author has already corrected the error and does not know how. - Pavel Mayorov

3 answers 3

Look carefully at the description of the error.

Fatal error: Cannot redeclare isitadmin () (previously declared in /home/heart.php:19) in /home/heart.php on line 37

The /home/heart.php function is declared 2 times in the file isitadmin

the first time it is declared in line 19, the second time in line 37

  • I will describe a little function, because I do not understand a little. in line 18, function A is declared, attention, in the 19th the if condition (whether cookies exist) {} in line 37 ends with a function, there is a '}'. Nowhere seems to be announced. Or I do not understand something. Please explain. - Emil Sabitov
  • 2
    This means that you connect heart.php 2 times when connecting files, use require_once - Alex Kapustin
 Cannot redeclare isitadmin() 

The answer is already written. I can not override it. those. the file is already somewhere connected and again also somewhere connected.

  • one
    the fact of the matter is that nowhere else is this file called at the moment. At the very beginning of the execution of index.php, turned on heart.php and assigned $ admin = isitadmin (). Then this function is not activated anywhere. Everywhere only $ admin is used. By the way, isitadmin returns 1 or 0. - Emil Sabitov

require_once do where you attach the file with this function.

  • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky