I have the following table in a .php page:
Code: Select all
<?php
echo '<div id="Games">';
echo '<table id="Games" border="1">';
while ($a=pg_fetch_row($gameTitleQueryResult)){
echo '<tr>';
for ($i=0; $i<pg_num_fields($gameTitleQueryResult); $i++){
echo '<td>'.htmlspecialchars($a[$i], ENT_QUOTES).'</ td>';
}
echo '<td><input type="checkbox" name="selectGame" value="'. $a['refnumber'].'" /></ td>
</ tr>';
}
echo '</table></ div>';
?>
As the code is, when I view the page in the browser, having clicked on the submit button which runs the SQL query, it is displaying
The one but last line, '; } echo ' is displayed in a single cell table, the rest is displayed as text on the web page.// now display query results in a table '; echo ''; while ($a=pg_fetch_row($gameTitleQueryResult)){ echo ''; for ($i=0; $i'.htmlspecialchars($a[$i], ENT_QUOTES).''; } echo '
'; } echo '
'; ?>
Could someone please point out to me where I'm going wrong, and what I need to amend in order to get the query results displayed in the HTML table?
Thanks!