Web Hosting Talk







View Full Version : Fatal error in PHP


mithilesh
12-19-2001, 07:03 PM
I have written some code in PHP but when i execute it it give some error:

CODE


<html>
<body>
<?
include_once 'DB.php' ;
$dbh = NULL ;

function on_session_start( $save_path, $session_name )
{
global $dbh;
$dbh = DB::connect('mysql://mithilesh:classic@localhost/SITE_SESSIONS',true);

if (DB::isError($dbh))
{
die(sprintf('Error [%d]: %s',$dbh -> getCode(), $dbh -> getMessage()));
}

}


ERROR


Fatal error: Cannot redeclare on_session_start() in d:\mith\php\DB.php on line 7


Please help me for solving this problem.

Thank you

driverdave
12-19-2001, 08:57 PM
It looks like you redeclare the function on_session_start() in DB.php on line 7, which you can't do.

Maybe if you gave us DB.php, this error might make more (or less) sense.

But your error right now is pretty self explanatory.

zupanm
12-19-2001, 11:17 PM
sounds like function on_session_start() is also in your include file you are loading.