<?php class article{ private $row; public function __construct(){ require_once('connection.php'); mysql_select_db($db, $test); $query = "SELECT * FROM articles WHERE path = $_SESSION['path']"; $result = mysql_query($query, $test) or die(mysql_error()); $this->row = mysql_fetch_array($result); } public function process($field) { if($field == 'tool'){ echo $this->row['path']; } else if($field == 'test'){ echo $this->row['title']; } } } $obj = new article(); $obj->process('tool'); $obj = new article(); $obj1->process('test'); ?>
$obj = new article(); $obj->process('tool'); $obj = new article(); $obj1->process('test');
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)