TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-21-2007, 12:42 PM   #1 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default uhum???

Quote:
Warning: Attempt to assign property of non-object in C:\wamp\www\DB Class 2\includes\classes.php on line 12
classes.php:
php Code:
<?php

/**
||||||||||||||||||||||||||||||||||||||||||
|||| @author Tanax
|||| @copyright 2007
||||||||||||||||||||||||||||||||||||||||||
**/


    include('classes/TANAXIA.php');
    include('classes/DB.php');
    $tanaxia->database = DB::getInstance($tanaxia['config']['database']['type']);   
    $tanaxia->database->setHandler(
               
                        $tanaxia['config']['database']['host'],
                        $tanaxia['config']['database']['user'],
                        $tanaxia['config']['database']['pass'],
                        $tanaxia['config']['database']['data']
                       
                        )
                        ->connect()
                        ->select();
                       
                       
    $tanaxia->user = TANAXIA::getInstance('user', $tanaxia->database);
   
?>

Ohye, and btw... the $tanaxia variables are declared in config.php.
And classes.php are included in config.php
Tanax is offline  
Reply With Quote
Old 11-21-2007, 12:55 PM   #2 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

The error means you are trying to set a variable on an object, that isn't an object.
__________________
Halo 3 Cheats
bluesaga is offline  
Reply With Quote
Old 11-21-2007, 01:00 PM   #3 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

But, I've used this in DB.php:

php Code:
<?php

/**
||||||||||||||||||||||||||||||||||||||||||
|||| @author Tanax
|||| @copyright 2007
||||||||||||||||||||||||||||||||||||||||||
**/


    function __autoload($database) {
       
        include_once('databases/' . $database . '.php');
       
    }

    class DB {
       
        public static $DB;

        public static function getInstance($type) {
       
            if(!is_object(self::$DB)) {
               
                $type = strtolower($type);
               
                switch($type) {
                   
                    case 'mysql':
                    
                        self::$DB = new DBmysql();
                        break;
                        
                    case 'mssql':
                    
                        self::$DB = new DBmssql();
                        break;
                        
                    default:
                    
                        self::$DB = new DBmysql();
                        break;
                        
                }
               
            }
           
         return self::$DB;
   
        }

    }


?>

So it should create the object for me... :S
Tanax is offline  
Reply With Quote
Old 11-21-2007, 02:02 PM   #4 (permalink)
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

I think the error is actually due to the left hand value, that is:

PHP Code:
$tanaxia->database 
Ensure the database property exists inside the $tanaxia object.
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote
Old 11-21-2007, 02:33 PM   #5 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Yeup, got it working :)
Thanks!
Tanax is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 01:45 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design