Web Hosting Talk







View Full Version : Intresting PHP Error


Studio64
07-03-2002, 06:27 PM
No No No... It's not the bug :D..

So here's the sample code from the page

<?

// Page statistic functions
// == Start

function query($q)
{
global $num_q;
$num_q++;
$res = mysql_query($q);
db_error($res);
return $res;
}

function create_time_end($starttime)
{
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
$totaltime = number_format($totaltime, 5);
return $totaltime;
}

function create_time_start()
{
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
return $starttime;
}

// == End



Simply Stuff...

Now here is the error...

Fatal error:
Cannot redeclare query()
(previously declared in /public_html/bb/function.php:6)
in /public_html/bb/function.php on line 6


Ummm... How can a function be re-declared on the line that it is being declared on?

Any suggestions anyone?

RRolfe
07-03-2002, 07:00 PM
a function can be redeclared if it is in a include file that is called multiple times during a loop.
thats the only time i have seen this error.

Studio64
07-03-2002, 07:16 PM
Nevermind... Found it... A cross include...