I am using the command DB::get_row($query) to run a query on the database but it seems to limit the number of times I can run it on one page view to four…
Does this make any sense to you… after the fourth call it always comes back empty…
I can make it work using a standard sql select from the tpl file but do not want to do that..
you can see what I mean at the link below then click on KBOS
public function get_next_flight($aircraft, $location) {
$query = "SELECT * FROM ".TABLE_PREFIX."schedules WHERE aircraft='$aircraft' AND depicao='$location'";
return DB::get_row($query);
}
I am building a aircraft placement and fight system for my va and with that function I only need one row out of the schedules table, I used get_row to avoid having two flights show up for the same aircraft just in case there were two in the db.
I am building a aircraft placement and fight system for my va and with that function I only need one row out of the schedules table, I used get_row to avoid having two flights show up for the same aircraft just in case there were two in the db.
Back to it 8)
Gotcha. I would add a LIMIT 1 and a ORDER BY column ASC/DESC so you can select which one in case there are multiples.
You can also do one query with get_results() by using GROUP BY aircraft, it will return one result row for each aircraft. Check out the stats functions for examples of that, but it might be more efficient.