Current location: Hot Scripts Forums » Programming Languages » PHP » define issues, I think


define issues, I think

Reply
  #11 (permalink)  
Old 11-28-09, 09:31 AM
connor connor is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Knob Noster, Mo
Posts: 228
Thanks: 1
Thanked 0 Times in 0 Posts
I got nothing, there isn't any errors or notices reporting...
__________________
Connor Strandt
JCS Photography
www.JCStrandt.com
Reply With Quote
  #12 (permalink)  
Old 11-28-09, 09:47 AM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
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>&nbsp;".$str."<br><br><b>MySQL Error (#".$this->errorno."):</b>&nbsp;".$this->errordesc."";
        }else{
            echo 
"<b>Error Type:</b>&nbsp;Configuration Error<br><br><b>There was an error on the $conf['debug'] line in your config file.";
        }
    }
}
?>
Reply With Quote
  #13 (permalink)  
Old 11-28-09, 09:52 AM
connor connor is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Knob Noster, Mo
Posts: 228
Thanks: 1
Thanked 0 Times in 0 Posts
The problem with that is that Im not including that file anywhere at the moment, its commented out and still the script doesn't work.
__________________
Connor Strandt
JCS Photography
www.JCStrandt.com
Reply With Quote
  #14 (permalink)  
Old 11-28-09, 01:20 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
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;">&lt;&gt;&lt;&gt; CONFIG IS SET TO DEBUG &lt;&gt;&lt;&gt;</div></body>

        </html>

Last edited by Jcbones; 11-28-09 at 01:25 PM.
Reply With Quote
  #15 (permalink)  
Old 11-28-09, 01:54 PM
connor connor is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Knob Noster, Mo
Posts: 228
Thanks: 1
Thanked 0 Times in 0 Posts
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
__________________
Connor Strandt
JCS Photography
www.JCStrandt.com
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Item Database Issues The Knowing PHP 15 11-19-09 05:42 PM
define() and include problem darkcarnival PHP 15 04-23-07 09:36 AM
difference between typedef and #define KSB C/C++ 1 10-09-06 04:34 PM
Include problem in C bkbenson C/C++ 4 02-08-05 04:24 AM
Constants, define(), and HTML Amulet PHP 5 01-10-05 04:55 PM


All times are GMT -5. The time now is 08:04 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.