When you look at the very stipped down code below, it will be obvious that I am new to PHP. Error checking and such has been removed.
My question is using an array as a class member.
Code: Select all
class connection
{
var $row;
#have tried initializing array with var $row = array('id' => " ",....)
function get_record($sql)
{
/*Have assigned values to variables in $this->row, which print out but cannot be changed in this function.
unset($this->row) does not clear array? */
$result=@mysql_query($sql);
#Have tried $this->row=array(mysql_fetch_assoc($result));
$this->row = mysql_fetch_assoc($result); #does not work
/* works
$row = mysql_fetch_assoc($result);
return $row
does not work
$this->row = $row;
or this
$this->row = array($row);*/
}
}I hope I am being clear enough, for my brain is starting to turn into mush. BTW, this PHP BBCode is great.
Thanks in advance,
Ken