I have the same problem, except it's not in a loop, and it isn't being included twice. I have two functions in the file, and the file is included once, the first function works, but the second one flags up the error. Both functions are called on the same page, so I don't have a clue what's going on.
Fatal error: Cannot redeclare count() in c:\server\apache\htdocs\portfolio\includes\functions.php on line 25
## Blog Function, Loads the blog! ##
function BLOG($User,$p) {
if (!$User['blog_limit'])
$limit = 12;
else
$limit = $User['blog_limit'];
if ($User['user_level']>=3){
$query="SELECT * FROM pf_blog ORDER BY time DESC LIMIT {$limit}";
}else
$query="SELECT * FROM pf_blog WHERE secure=0 ORDER BY time DESC LIMIT {$limit}";
$result=mysql_query($query)
or die("Can't execute query!");
$num_rows=mysql_num_rows($result);
$count=1;
while ($row = mysql_fetch_array($result))
{
extract($row);
if ($p==0) $action="homepage_blog";
include("page/blog.php");
$count++;
}
}
## Count function, registers hits and IPs ##
function COUNT() { # < < < < < < < < < < < < < line 25
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
$addcount = mysql_query("INSERT INTO pf_count
SET ip='$ip',
time='$time';");
}
Thats my functions.php.
<?php
include("includes/includes.php");
COUNT();
?>
Thats my code to load the includes page, and to start the COUNT();
include_once("includes/database.php");
include("includes/configuration.php");
include("includes/functions.php");
And that is my includes page. No where else is there a command to include the functions.php anywhere on index2.php.
This is real baffling, all help is welcome.