I have never programmed anything in php before and haven't touched html in 10 years. I could use some help. I am querying a postgresql database using php. I am trying to display my query results in a table format with headers like this:
first_name last_name employee_id
tom jones 111
bob barker 112
bill davis 113
Sample code I am trying to get to work correctly:
echo("<table border=2");
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
foreach ($line as $col_value => $row_value) {
echo("<tr><td>$col_value</td><td>$row_value</td></tr>\n");
}
}
echo("</table>");
My formatting is being displayed like this:
first_name tom
last_name jones
employee_id 111
first_name bob
last_name barker
employee_id 112
first_name bill
last_name davis
employee_id 113
As you can see I am storing my query in an associative array.
Thanks for any help.