Re: first php class take 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



nihilism machine schreef:
How does this look now?

just as bad as before. you haven't even tried to run the code have you?


<?php

class dbconfig {
    public $connInfo = array();
    public $connInfo[$hostname] = 'host.com';
    public $connInfo[$username] = 'dbuser';
    public $connInfo[$password] = 'dbpass';
    public $connInfo[$database] = 'mydbname';

    public __construct() {
        return $this->$connInfo;
    }
}

?>

<?php

include_once("dbconfig.class.php");

class dbconn extends dbconfig {

    public $DB;
public __constructor(){
        $this->$connInfo = new dbconfig();
        $username =
        $hostname =
        $password =
        $database =
$DB = new PDO("mysql:host=$connInfo[$hostname];dbname=$connInfo[$database]", $connInfo[$username], $connInfo[$password]);
        return $DB;
    }
}

?>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux