Background
- Here is the following code which will select four fields from a MySQL table
called
a_aif - I want to present this data in an html table and highlight the row background where the
a_aif.aif_idis equal toremaining_if.aif_id - I have defined a variable in the SQL query that satisfies this condition above and defined it
remaining_aifs
Issues - Please see the red arrows/highlighted syntax for where I think the problem lies...

PHP Script
<?php
require_once 'config.php';
$dbh = new PDO($dsn, $dbuser, $dbpass);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$result = $dbh->query("
SELECT a_aif.aif_id,
a_aif.fee_source_id,
a_aif.company_name_per_sedar,
a_aif.document_filing_date,
IF (a_aif_remaining.aif_id IS NULL, 0, 1) remaining_aifs
FROM a_aif
LEFT JOIN a_aif_remaining
ON a_aif_remaining.aif_id = a_aif.aif_id
ORDER BY aif_id DESC");
$result->setFetchMode(PDO::FETCH_ASSOC);
if ( !empty($result) ) : endif;
?>
<table>
<tr>
<th><b>Document ID</b></th>
<th><b>Pubco Name</b></th>
<th><b>Filing Date</b></th>
<th><b>PDF</b></th>
</tr>
<?php foreach($result as $index => $row) : ?>
<tr
<?php
if('a_aif.aif_id' === 'remaining_aifs'
echo "<tr class='highlighted'>";
else echo "<tr>";
?>
>
<td><?php echo $row[fee_source_id]; ?></td>
<td><?php echo $row[company_name_per_sedar]; ?></td>
<td><?php echo $row[document_filing_date]; ?></td>
<td></td>
</tr>
<?php endforeach;
$dbh = NULL;
?>
</table>
?in<?phpand your code results in a parse error when run.