I call the getTitle function but it only returns the last DB value. I presume that is because there are many rows in the DB with the same 'code' However when I call the function I want to get all the values for TITLE where code is something in the DB not just the last one.
Help Please! Thank you very much!!!
class Entry
{
private $title;
private $date;
private $place;
private $description;
private $code;
function __construct($c)
{
$this->code=$c;
$dbc=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die('Failed'.mysql_error());
mysql_select_db(DB_NAME);
$query="SELECT TITLE FROM entry WHERE CODE='".$c."'";
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
$this->title=$row['TITLE'];
}
mysql_close();
}
function getTitle()
{
return $this->title;
}
}
?>