FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » fatal error: cannot redeclare
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
fatal error: cannot redeclare [message #171901] Thu, 20 January 2011 17:38
Jivanmukta is currently offline  Jivanmukta
Messages: 20
Registered: January 2011
Karma:
Junior Member
Hello,
I have fatal error "Cannot redeclare openDatabase()". My script starts
with:

<?php
require_once 'include/common.inc.php';
require_once 'include/functions.inc.php';
require_once 'include/database.inc.php';
require_once 'include/announcement.inc.php';
require_once 'include/Captcha.php';
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
error(ERRMSG_POST_ALLOWED_ONLY);
}
sessionBegin();
savePostInSession();
if (!openDatabase()) {
error(ERRMSG_DATABASE_ACCESS_PROBLEM);
}

where database.inc.php contains single definition of openDatabase():

<?php

require_once 'common.inc.php';


if (!isset($db)) {

$db = null;
}

$inTransaction = false;


$regions = array();

$estateTypes = array();

$ownership = array();

$standards = array();

$furnitureTypes = array();

$offerTypes = array();

$currencies = array();

$agencies = array();

$priceFor = array();

$units = array('M2' => 'm<sup>2<\/sup>', 'HA' => 'ha (hektarów)');
$vulgar = array();


function openDatabase() {

global $db;

try {

$db = new PDO('mysql:host=' . MYSQL_SERVER . ';dbname=' .
MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD);

$db->exec('SET NAMES latin2');

$db->exec('SET CHARACTER SET latin2 COLLATE latin2_general_ci');

$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

register_shutdown_function('closeDatabase');

} catch (PDOException $e) {

return false;

}

return true;

}

Remaining required_once files do not contain function openDatabase().
[Message index]
 
Read Message
Previous Topic: USA Free classified site for free ad posting !!!
Next Topic: Re: DOS newlines (CR/LF) to Unix format
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 16:44:46 GMT 2024

Total time taken to generate the page: 0.05630 seconds