<?php
	//connection
	include("connection.php");
    include("frames_header.php");
	
	$requete= $_POST["query"];
	$requete=str_replace("\\","",$requete);
	print $requete."<br><br><br>";
	
    $stmt = pg_query($c,$requete) or die("<strong>Error</strong> ".pg_last_error($c));

    $count=0;
	print "<TABLE BORDER=\"1\">";
	
	print "<tr>";
	for($p=0;$p<pg_num_fields($stmt);++$p){
	    print "<td>".pg_field_name($stmt,$p)."&nbsp;</td>";
	}
	print "</tr>";
	
	while ($row=pg_fetch_array($stmt)) {
	   print "<tr>";
	   for($p=0;$p<pg_num_fields($stmt);++$p){
		   print "<td>".$row[$p].'&nbsp;</td>';
	   }
	   ++$count;
	   print "</tr>";
	}
	print "</TABLE>";
    print "<br>$count lines<br>";

?>




<?php
    include("frames_footer.php");
?>