<style>
	body { background-color: #eeeeee; }
	border:0
	valign="top"
</style>
<?php
require_once("VatsimPHPgenerator.php");
$VatsimPHP=new VatsimPHP;
$pilotlist=$VatsimPHP->pilots();
$flag=0;
$found = false;
foreach ($p in $pilotlist) {
     $m = substr($p[11],0,4)."|".substr($p[13],0,4);
     if (preg_match("/TTCP|TGPY|TBPB/", $m)) { 
          printf("<tr><th>%s</th><td>%s</td><td>-%s</td></tr>", $p[0], $p[11], $p[13]);
          $found = true;
     }
}
if (!$found) print("<tr><td>There are currently no ongoing flights within the Piarco airspace.</td></tr>");

?>

That is my PHP script. I get the following error:

"Parse error: syntax error, unexpected T_STRING in /home/colst0/public_html/piarco/piarcotest.php on line 12"

I've been cracking away at this for a little over a week, and am lost. Anyone have a suggestion?

in your foreach statement use "as" instead of "in". i think in is used in javascript not php.

Same error given :'(

i didn't look hard enough the first time.

the foreach statement should be:

foreach ($pilotlist as $p) {

should help. i don't see anything else wrong.

Great. That solved the issue. The only issue is that the script produces something with no spaces, like this:

BWA417KJFK-TBPBN76JRTJSJ-TBPB

when it should be:

BWA417 KJFK-TBPB
N76JR TJSJ-TBPB

This is the HTML output:

<tr><th>BWA417</th><td>KJFK</td><td>-TBPB</td></tr><tr><th>N76JR</th><td>TJSJ</td><td>-TBPB</td></tr>

put some padding on the table

Ok, I thought the TH tag would keep each string on it's own line

th is the same as the td tag except it add a bold style and centering

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.