hi ! I wanna add a “online flights” stat to my airline stats section. I made a custom pirep field dropdown “flew online” with the option “yes or no”.. Is it possible to have a code that if “yes” was selected
it would add to a online flight total displayed on the front of my page ?
hi ! I wanna add a “online flights” stat to my airline stats section. I made a custom pirep field dropdown “flew online” with the option “yes or no”.. Is it possible to have a code that if “yes” was selected
it would add to a online flight total displayed on the front of my page ?
thanks !
Build a class with a sql call something like ->
<?php
function get_onlineflights() {
$query = "SELECT COUNT(*)AS total FROM '.TABLE_PREFIX.'pirepvalues WHERE value = 'Yes'";
return DB::get_row($query);
}
?>
You need to create a new class or include it in an existing one, but if you include it in an existing one it will be overwritten in an update of the system. Then when you call it from our module or template (module preferably) you change the
Create a file called vatsimflightsData.class.php in your core/common folder and put this in it ->
<?php
class vatsimflightsData extends CodonData {
function get_onlineflights() {
$query = "SELECT COUNT(*)AS total FROM '.TABLE_PREFIX.'pirepvalues WHERE value = 'Yes'";
return DB::get_row($query);
}
}
?>
after the data call and see what it pukes out. if it empty something in the db call is not correct, I use the screenshot in the first post to write the call, so if something in your db is different than that it will not work.
is the “field id” relevant ? I noticed the fieldid for the vatsim dropdown is 4. if the code only pulls (yes,no) from that fieldid could that help it ?