0

for example this $name = pulic $wherever; so I can call, for example, wherever->wherever;

so that I don't have to type this name every time I add the variables

// If it's going to need the database, then it's 
// probably smart to require it before we start.
require_once('database.php');

class Logs extends DatabaseObject {

protected static $table_name="logs";
protected static $db_fields = array('id', 'username', 'ip', 'time', 'page');



public $id;
public $username;
public $ip;
public $time;
public $page;
1
  • I don't understand what you're asking. Have you looked at __get? Commented May 21, 2012 at 20:01

1 Answer 1

0

You can use extract().

extract( $db_fields ); 

Then you won't need to declare them one by one.

class Logs extends DatabaseObject {

protected static $table_name="logs";
protected static $db_fields = array('id', 'username', 'ip', 'time', 'page');

extract( $db_fields ); 
Sign up to request clarification or add additional context in comments.

1 Comment

i just done this way i think it works fine

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.