Jump to content

DB Error


Xtremer360

Recommended Posts

My database connection works because I use the file for my custom CMS script however the only way it'll let me use that connection is if I put a require code inside of each of my functions on my functions page. I'm not sure why that's needed. When I take out the require dbconfig file out of each function it says that the mysqli_query is returning NULL for all of my functions. I'm not sure why I have to have the file included.

 

<?php

/**
* @author Jeff Davidson
* @copyright 2010
*/

// This file contains the database access information and establishes a connection to MySQL and selects the database

// Set the database access information as contstants

DEFINE ('DB_USER', '?');
DEFINE ('DB_PASSWORD', '?');
DEFINE ('DB_HOST', '?');
DEFINE ('DB_NAME', '?');

// Make the database connection

$dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

if ($dbc) {
}else {
    die('Connect Error: ' . mysqli_connect_error());
}

?>

 

 

This is just the header.php of my webpage.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <title>Kansas Outlaw Wrestling :: True Outlaws of the Midwest</title>
    <link rel="stylesheet" type="text/css" href="http://www.kansasoutlawwrestling.com/css/styles.css" />
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="http://www.kansasoutlawwrestling.com/js/kow.js"></script>
    <?php require ("efedmanager/inc/dbconfig.php") ?>
    <?php require ("functions.php"); ?>
</head>

Link to comment
https://forums.phpfreaks.com/topic/236771-db-error/#findComment-1217163
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.