View Single Post
Old 07-03-2008, 07:28 AM   #10 (permalink)
codefreek
The Frequenter
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 408
Thanks: 220
codefreek is on a distinguished road
Help What is wrong now?

whats wrong now :S?
Quote:
//i know i am outputting the value the wrong way i think..

PHP Code:
<?php
error_reporting
(E_ALL & ~E_NOTICE);

class 
db_connect 
{
 
    private 
$dbn;
    private 
$user;
    private 
$pass;
    private 
$db_selected;
    private 
$dbtestcon;

    
    public function 
db_connect()
    {

        
        
$this->specs('localhost''orb''123123');
        
$this->showConnectionDetails('zone');
    
    
    }
 
    public function 
specs ($dbn$user$pass
    {
        
        
$this->dbn $dbn;
        
$this->user $user;
        
$this->pass $pass;

        
        
$this->dbtestcon mysql_connect($dbn$user$pass);

        if ( ! 
$this->$dbtestcon
        {
            die(
'Could not connect: ' mysql_error());
        }

        echo 
'Connected successfully';
    } 


    
// Now this function will work
    
function showConnectionDetails($db_selected)
    {
    
$this->db_selected $db_selected;
    
    
$db_selected mysql_select_db($this->db_selected$this->dbtestcon);
            if (!
$db_selected)
        {
            die (
'Can\'t use workspace : ' mysql_error());
        }
        echo 
'db_selected';
    }
 
}

?>
__________________
inquisitive
1. Eager to acquire knowledge.
2. Too curious; overly interested; nosy.

Last edited by codefreek : 07-03-2008 at 08:23 AM. Reason: CODE EDIT. 4th Time.
codefreek is offline  
Reply With Quote