Re: database class

From: Date: Wed, 21 May 2003 20:45:07 +0000
Subject: Re: database class
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-27949@lists.php.net to get a copy of this message
echo"connect"; Does this line have a space between echo and "" ?? echo and quotes are together. Maybe that's the problem At 10:40 PM 5/21/2003 +0200, you wrote:
HI, Not really a db problem, but has something to do with a dbase I'm tryin to make a database class, but every time i make a class, and execute the file i get: Parse error: parse error, expecting T_OLD_FUNCTION' or T_FUNCTION' or T_VAR' or '}'' in /home/new.php on line 4 I have one working class but another just wont work... The not working one (simplyfied) <?php class Dbase {
    function connection() {
        echo"connect";
    }
} ?> -------- <?php include ("dbase.php"); $test = new Dbase; $test->connection(); ?> The code i made which works: class Database {
        function Database($host, $database, $username, $password) {
                $this->host = $host;
                $this->database = $database;
                $this->username = $username;
                $this->password = $password;
        }
        function connect() {
                $this->db = mysql_connect($this->host, $this->username, $this->password);
                if ($this->db == false) {
                        return FALSE;
                } else {
                        return TRUE;
                }
        }
} // Make the object $db = new Database("localhost", "dbase", "user", "pass"); $db->connect(); what am i doing wrong? Cuz i really dont understand this.. really freaking me out Tnx in Advance Fedde
Jadiel Flores ------------------------- http://www.abargon.com jflores@abargon.com (52-55) 52-29-80-34

« previous php.db (#27949) next »