I have a page header.php which have all the fuctions and db connection pages included in them, i made another page sidebar.php and i included it into another page category.php
So now 1.header.php - inside header config.php,functions.php 2.category.php - inside this includes header.php and sidebar.php
The problem is the db connection made in the sidebar.php is having error or not connecting when i take the url sidebar.php while includeing the config.php file i get the correct output if not i have nothing
when i include the config in sidebar.php and then include sidebar.php in category.php page i get error
"Fatal error: Cannot redeclare db_pconnect() in /var/www/clients/client9/web35/web/beta3/classes/dblib.inc on line 16"
Code: header.php
<?php
require_once '../classes/config.php';
$cur_file = basename($_SERVER['PHP_SELF']);
if ($login_required == "YES" && empty($_SESSION['SESS_MEMBER_ID'])) {
header("location:../login.php");
}
require_once '../functions.php';
?>
category.php
<?php require_once("templates/header.php"); ?>
<?php include("category_bar.php"); ?>
<div class="container">
<div class="content-second">
<div class="row">
sidebar.php
<?php require_once("templates/header.php"); ?>
<div class="container-fluid">
<div class="row">
The page which i needs data code is
<?php
$sql_cat_1 = db_query("Select * from jp_newcat where ncat_parentid='0'");
while($sql_cat_res = db_fetch_object($sql_cat_1)){
?>
<li><a href="category.php?cid=<?php echo $sql_cat_res->ncat_id; ?>"><?php echo $sql_cat_res->ncat_name; ?></a></li>
<?php } ?>