Try this one: I took out your custom error's and returned error's straight from mysql.
db.php
PHP Code:
<?PHP
//defined('__sn') or die();
//define('__sn', 1);
class db{
var $host = "";
var $user = "";
var $pass = "";
var $datb = "";
var $errordesc = "";
var $errorno = "";
// Query vars
var $queryid = 0;
var $results = array();
function db($host,$user,$pass,$datb){
$this->host=$host;
$this->user=$user;
$this->pass=$pass;
$this->datb=$datb;
}
// Create Database Connection \\
function newconn(){
$this->connection = mysql_connect($this->host, $this->user, $this->pass) or die(mysql_error());
if(!$this->connection){
$this->error("Couldn't connect to host: ".$this->host."");
}else
if(!mysql_select_db($this->datb, $this->connection)){
$this->error("Couldn't connect to database: ".$this->datb."");
}
}
// Create a Database Query \\
function query($query){
$this->queryid = mysql_query($query, $this->connection) or die(mysql_error());
return $this->queryid;
}
// Count Rows \\
function num_rows(){
$this->num=mysql_num_rows($this->queryid);
return $this->num;
}
// Fetch an array out of a database \\
function fetch_array($id=-1){
if($id==-1){
$res=mysql_fetch_array($this->queryid);
}else{
$res=mysql_fetch_array($id);
}
return $res;
}
// Insert into a table \\
function insert($table, $data){
}
// Update a table \\
function update($table, $data, $where){
}
// Delete out of a table \\
function delete($table, $where){
}
// Output errors \\
function error($str=""){
$this->errordesc=mysql_error();
$this->errorno=mysql_errno();
if($CONF['__DEBUG']=="1"){
echo "<b>Error Message:</b> ".$str."<br><br><b>MySQL Error (#".$this->errorno."):</b> ".$this->errordesc."";
}else{
echo "<b>Error Type:</b> Configuration Error<br><br><b>There was an error on the $conf['debug'] line in your config file.";
}
}
}
?>
So I plugged in these scripts into my local server.
You have your directory for layout named as include, is it name include, or includes ?
I received an error.
Code:
Warning: include(includes/layout.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\test\inc.php on line 8
Warning: include() [function.include]: Failed opening 'includes/layout.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\test\inc.php on line 8
Fatal error: Class 'layout' not found in C:\wamp\www\test\inc.php on line 9
So, I changed the "include" directory to "includes"
Now the output is:
Code:
<br />
<b>Warning</b>: include(../config.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in <b>C:\wamp\www\test\includes\layout.php</b> on line <b>4</b><br />
<br />
<b>Warning</b>: include() [<a href='function.include'>function.include</a>]: Failed opening '../config.php' for inclusion (include_path='.;C:\php5\pear') in <b>C:\wamp\www\test\includes\layout.php</b> on line <b>4</b><br />
<br />
<b>Notice</b>: Undefined index: theme in <b>C:\wamp\www\test\includes\layout.php</b> on line <b>18</b><br />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SoldiersNet - Staff Portal</title>
<link rel="shortcut icon" href="images/favicon.ico">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../lib/ext/resources/css/ext-all.css">
<!-- <link rel="stylesheet" type="text/css" href="../theme//style.css"> -->
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../lib/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../lib/ext/adapter/ext/ext-all.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="../lib/ext/ext-all-debug.js"></script></head>
<body scroll="no" bgcolor="#B7BBBE">hello<br />
<b>Notice</b>: Undefined variable: HARD in <b>C:\wamp\www\test\includes\layout.php</b> on line <b>33</b><br />
<div align="right" style="color:#666666; margin-bottom:0px; margin-right:0px;">Version: </div><div align="center" style="color:#666666; margin-bottom:0px; margin-right:0px;"><><> CONFIG IS SET TO DEBUG <><></div></body>
</html>
Ok, now on layout.php I have taken the include for the config file out ant it works for the most part other than the config vars don't work on the layout.php which is expected because im not including the config.php on the layout.php