View Single Post
Old 07-02-2008, 09:53 PM   #7 (permalink)
codefreek
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

PHP Code:
<?php
error_reporting
(E_ALL & ~E_NOTICE);
 
class 
db_connect 
{
 
    private 
$dbn;
    private 
$user;
    private 
$pass;
    private 
$db_selected;
    
    public function 
db_connect()
    {
        
$this->specs('localhost''orb''123123');
        
$this->showConnectionDetails();
    }
 
    public function 
specs($dbn$user$pass$db_selected
    {
    
$this->db_selected $db_selected;
        
$this->dbn $dbn;
        
$this->user $user;
        
$this->pass $pass;
 
        
$dbtestcon mysql_connect($dbn$user$pass);
        if (!
$dbtestcon
        {
            die(
'Could not connect: ' mysql_error());
        }
        echo 
'Connected successfully';
    }
 
    
// Now this function will work
    
function showConnectionDetails()
    {
     
        
$db_selected mysql_select_db('zone'$dbtestcon);
    if (!
$db_selected)
    die (
'Can\'t use workspace : ' mysql_error());

    }
 
}

?>
what am i doing wrong with this snippet of code??..

Last edited by codefreek : 07-03-2008 at 06:30 AM.
codefreek is offline  
Reply With Quote