Help on OOPsyntax in php4
| From: | Bogdan Grabinski | Date: | Thu, 07 Oct 1999 23:41:30 +0000 |
| Subject: | Help on OOPsyntax in php4 | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-5358@lists.php.net to get a copy of this message | ||
I ma new to PHP and probably making sum bags.
Please help with OOP portion.
Is php supporting private: and public: in class declarations?
Where can I find info describing new capabilities?
This is Example of code that is working to sum extend,
but I can't reference variables in OO fashion;
like:
echo $obj->db_name;
// Example:
class DBopen {
var $db_host, $db_user, $db_password, $conn;
var $db_name, $db_stat;
var $query, $res, $row;
function select($query){
$this->query = $query;
$this->res = mysql_query($this->query);
while($this->row = mysql_fetch_object($this->res));
}
function init($db_host, $db_user, $db_password, $db_name){
$this->db_host = $db_host;
$this->db_user = $db_user;
$this->db_password = $db_password;
$this->db_name = $db_name;
$this->conn = mysql_pconnect($this->db_host, $this->db_user,
$this->db_password)
or die( exit_dump("reviews_core.php",
__LINE__, $REMOTE_ADDR, $HTTP_USER_AGENT, "") );
$this->db_stat = mysql_select_db($this->db_name, $this->conn);
printf("abc");
}
};
// ------------------------------------
Bpogdan.