This is a C program that generates an HTML page with a table populated from an SQL query.

#include <stdio.h>
#include <stdlib.h>
#include 'mysql.h'

MYSQL mysql;

void err(void) {
    fprintf(stderr, '%s', mysql_error(&mysql) );
    exit(1);
}

int gen_page() {
    puts('');
    if(!(mysql_connect(&mysql,'host','user','passwd'))) err();	
    if(mysql_select_db(&mysql,'my_db')) err();
    if(mysql_query(&mysql,'SELECT * FROM my_table')) err();
    if(!(res = mysql_store_result(&mysql))) err();
    while((row = mysql_fetch_row(res))) {
        puts('');
        for (i=0 ; i < mysql_num_fields(res); i++) 
            printf('',row[i]);
        puts('');
    }
    puts('
%s
'); if (!mysql_eof(res)) err(); mysql_free_result(res); mysql_close(&mysql); }
Here is the same thing in PHP which produces the same output.

<html><body><table>
<?php
  mysql_connect
('host','user','passwd') or die(mysql_error());    
  
$res mysql_db_query('my_db','SELECT * FROM my_table'
         or die(
mysql_error());
  while((
$row mysql_fetch_row($res))) {
      echo 
'<tr>';
      for (
$i=$i mysql_num_fields($res); $i++) 
          echo 
"<td>{$row[$i]}</td>\n";
      echo 
'</tr>';
  }
?>
</table></body></html>