$query_count = "SELECT COUNT(*) FROM ".TABLE_PREFIX."schedules WHERE aircraft=".$aircraft->id." AND depicao='$location'";
$rowcount = DB::get_row($query_count);
echo $rowcount;
I get the error:
Catchable fatal error: Object of class stdClass could not be converted to string in /Users/Nout/Desktop/ZE Site/core/templates/realschedulelite/realschedulelite_airport_details.tpl on line 56
What I have in place is a table of flights per airport which pilots can then book. Thus I use “foreach” to display a new table-row per flight. That works perfectly for any airport with more than one flight departing it.
For an airport with only one flight departing it, the table is shown but above it theres an ugly error reading:
Warning: Invalid argument supplied for foreach() in /Users/Nout/Desktop/ZE Site/core/templates/realschedulelite/realschedulelite_airport_details.tpl on line 133
So what I want is to count rows and if theres is only one applicable row I remove the foreach and use DB::get_row otherwise the foreach clause is used with DB::get_results.