Hello - the site I'm working on makes heavy use of a couple databases - one containing a list of events, the other a list of speakers for those events. I'd like to be able to create an object oriented solution where I'd just feed it a query, and then I'd be able to access elements like speaker, date, program cost and such as array items individually.
So, I have a little bit of a framework, but could use some help with actually getting the array together - little unclear on how to do this:
<?php
class UpcomingQuery {
var $inputquery = $input_q;
function UpcomingQuery ($conn) {
$result = mysql_query($inputquery, $conn);
while ($special = mysql_fetch_array ($this ->result)) {
$array = (some code to load an array of all elements - need help here)
}
return $array;
}
}
class UpcomingOutput {
function displayspeaker () {
echo "<tr>";
foreach ($speakers as $speaker) {
echo $speaker . "<br>\n";
}
echo "<br>";
echo "</td>";
}
echo "</tr>";
}
}
?>
Ideally, I'd be able to just include this class and then have a template and be able to just call <?php displayspeakers(); ?> and have all the speakers for that query come out. Any ideas on how to create that array? Thanks.