Hi,
I have a class that i am using and want to know how to echo a result from this.
This is a class
[PHP]
class database {
function selects($select) {
$this->result = mysql_query($select,$this->connection);
$this->row = mysql_fetch_assoc($select);
}
function getRes() {
while ($res = mysql_fetch_array($this->result)) {
$this->reser[] = $res;
}
return $this->reser;
}
}
[/PHP]
Here is the code
[PHP]$current = new database;
$current->selects("SELECT * FROM users WHERE id = '$_COOKIE[id]'");
$cresults = $current->getRes();
// assign your db results to the template
$smarty->assign('cresults', $cresults);
[/PHP]
I though i would be able to do something like:
print $cresults['username'];
But this does not work.
Any Ideas?
Cheers,
Adam