<html>
<head>
    <title>ODBC Test</title>
</head>

<body>
<h1>ODBC-Test</h1>

<?php
$cid = odbc_connect( "Driver=PostgreSQL;Server=localhost;Database=test", str_repeat("A",11000), "" );
if( !$cid ) {
    echo "<p>Unable to connect to db!</p></body></html>";
    exit;
}
echo "<p>DB connection successful.</p>";

$res = odbc_exec( $cid, "select * from zahlung" );
if( !$res ) {
    echo "<p>Error with odbc_exec(): " . odbc_errormsg() .  "</p></body></html>"; 
    exit;
}
?>

<table>
    <tr>
	<th>id</th>
	<th>Date</th>
	<th>Room</th>
	<th>Amount</th>
    </tr>
<?php
while( odbc_fetch_row( $res ) ) {
    echo "<tr><td>" . 
	odbc_result( $res, 1 ) . "</td><td>" . 
	odbc_result( $res, 2 ) . "</td><td>" .
	odbc_result( $res, 3 ) . "</td><td>" .
	odbc_result( $res, 4 ) . "</td></tr>\n";
}
?>
</table>
</body>

</html>
