Echoing a Variable

I’m working one of the new features for WorldACARS that pulls aircraft data from the database, displays it, gets processed by WorldACARS then displays it to the user.

For some reason the code I wrote doesn’t work:

(It pulls data from url, e.g http://localhost/action.php/wacars/maintence?reg=VH-FTW)

public function maintence()
		{
				$reg = $_GET['reg'];      		   		
				$aicraft = self::getAircraftInfo($reg);
				echo "$aicraft->totaltime";
		}

		public static function getAircraftInfo($reg)
		{
			$reg = DB::escape($reg);

			return DB::get_row('SELECT * FROM '.TABLE_PREFIX.'aircraft 
								WHERE `registration`='.$reg);
		}

Could someone please tell me whats wrong with it?

Thanks,

Mitch

You should be using $this->get->reg

Also, you don’t need static, you can just call it using $this->getAircraftInfo(). Though you should call the API OperationsData::getAircraftInfo()

I am still getting a blank page…

Does the OperationsData::getAircraftInfo($id) $id mean the registration or the actual aircraft id (1,2,3 etc.). WorldACARS sends the data as the registration of the aircraft and not the numeric ID.

Updated Code:

public function maintence()
		{
				$reg = $this->get->reg;      		   		
				$aircraft = $this->getAircraftInfo($reg);
				echo "$aicraft->totaltime";
		}

You’d use this:

http://docs.phpvms.net/api/codon_core/OperationsData.html#getAircraftByReg