Member Avatar for AlTaylorParker

I'm trying to create a function that builds the content of a page and add database info at a specific point in the process. I get this error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\EasyPHP-5.3.8.0\www\test\dukejets\view\pagecreator82812.php on line 20

This is line 20:

"\t\t\t echo $content = content($row['ICAO'], $row['FAA'], $row['Name'], $row['Place'], $row['State'], $row['Country'], $row['Elevation'], $row['RunwayID'], $row['RunwayLength'], $row['RunwayWidth'] );\r" .  

Here's the entire function:

function template($i){
    $body = "<?php\r" . 
            "\tinclude 'header.php';\r" . 
            "\tinclude 'uppercontent.php';\r"  . 
            "\tinclude 'functions.php';\r" . 
            "\tset_time_limit(130);\r" .
            "\t$con = mysql_connect('localhost','admin','a28792879');\r" .
                "\t\tif (!$con)\r" .
                    "\t\t\t{\r" .
                    "\t\t\tdie('Could not connect: ' . mysql_error());\r" .
                    "\t\t\t}\r" .
            "\t$j = " . $i . ";\r" . 
            "\tmysql_select_db('trail', $con);\r" . 
            "\t$query = 'SELECT * FROM airports WHERE numbers = $j';\r" .
            "\t$result = mysql_query($query) or die(mysql_error());\r" .
                "\t\twhile($row = mysql_fetch_array($result))\r" . 
                    "\t\t\t{\r" . 
                    "\t\t\t echo $content = content($row['ICAO'], $row['FAA'], $row['Name'], $row['Place'], $row['State'], $row['Country'], $row['Elevation'], $row['RunwayID'], $row['RunwayLength'], $row['RunwayWidth'] );\r" .
                    "\t\t\t$id = $row['ID'];\r" .
                    "\t\t\t}\r" .
            "\t$query2 = 'SELECT * FROM fbo WHERE AirportID=$id';\r" .
            "\t$result2 = mysql_query($query2) or die(mysql_error());\r" .
                "\t\twhile($row2 = mysql_fetch_array($result2))\r" .
                    "\t\t\t{\r" .
                    "\t\t\techo $content2= fboContent($row2['Name'], $row2['Email'], $row2['Address1'], $row2['Website'], $row2['Address2'], $row2['City'], $row2['ZipCode'], $row2['Country'], $row2['Phone1'], $row2['Phone2']);\r" .
                    "\t\t\t}\r" .
            "\tinclude 'lowercontent.php';\r" .        
            "\tinclude 'footer.php';\r" . "?>";
    return $body;
  }

What am I missing?

Member Avatar for diafol

I really don't understand why you're doing it like this, but anyway, it's because of the $ - it needs to be escaped by a backslash (). Replace all $row with \$row.

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.