Skip to main content

PHP

warning: Creating default object from empty value in /var/www/venutip.com/public_html/modules/taxonomy/taxonomy.pages.inc on line 33.

An easier way to assign instance variables

File under

Ever find yourself doing something like this?

$q = "SELECT * FROM person WHERE id=$id";
$r = mysql_query($q);
$row = mysql_fetch_array($r);

$this->id = $row['id'];
$this->firstName = $row['firstName'];
$this->lastName = $row['lastName'];
...
$this->pantSizeAfterThanksgiving = $row['pantSizeAfterThanksgiving'];
Syndicate content