# Simple OOP problem; why won't this work?!

**URL:** <https://forum.kirupa.com/t/simple-oop-problem-why-wont-this-work/270550>\
**Category:** programming\
**Created:** [September 10, 2008, 9:47pm UTC](https://forum.kirupa.com/t/simple-oop-problem-why-wont-this-work/270550 "2008-09-10T21:47:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sage\_of\_Fire](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sage\_of\_Fire](https://forum.kirupa.com/u/Sage_of_Fire)\
**Post date:** [September 10, 2008, 9:47pm UTC](https://forum.kirupa.com/t/simple-oop-problem-why-wont-this-work/270550/1 "2008-09-10T21:47:18Z")

</div>

I’m trying to abstract one of my php scripts into a class, and I keep getting nonsense errors. I have experience in AS3 OOP, but this is so simple yet so broken. Here’s the class:

```auto

<?php

class DBModel {

  private $dbc;
  private $table;
  
  public function __construct($new_dbc, $new_table) {
    $this->$dbc = "something";
    echo "Made DBModel:" . $new_dbc . $new_table;
  }
}

?>

```

… and the script that instantiates it:

```auto

<?php

require_once ('classes/dbmodel.php');

$db_model = new DBModel('string','Number');

unset($dbc);

?>

```

… and the error.

```auto

Fatal error: Cannot access empty property in /home2/appalac7/public_html/classes/dbmodel.php on line 9

```

I’m running php 5.2, so I know it’s not version problems. Thanks.
