All pastes #964174 Raw Edit

Stuff

public php v1 · immutable
#964174 ·published 2008-03-31 01:38 UTC
rendered paste body
$print_id = false;$query = "SELECT *          FROM vlans";$result = pg_query($query);if (!$result) {  echo "Problem with query " . $query . "<br/>";  echo pg_last_error();  exit();}print "<html>";print "<body>";print "<table>";$i = pg_num_fields($result);for ($j = 0; $j < $i; $j++){  $fieldname = pg_field_name($result, $j);  if($print_id){     print "<th> $fieldname </th>";  }else{        if(eregi("[^id]", $fieldname)){                print "<th> $fieldname </th>";        }  }}while($row = pg_fetch_row($result)){  print("<tr>");  $row_nbrs = count($row);  if($print_id){     for($j = 0; $j < $i; $j++){        print "<td>$row[$j]</td>";     }  }else{     for($j = 1; $j < $i; $j++){        print "<td>$row[$j]</td>";     }  }  print("</tr>");}print "</table>";print "</html>";