<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
maxdb_query($link, "CREATE TABLE temp.friends (id int, name varchar(20))");
maxdb_query($link, "INSERT INTO temp.friends VALUES (1,'Hartmut')");
maxdb_query($link, "INSERT INTO temp.friends VALUES (2, 'Ulf')");
$stmt = maxdb_prepare($link, "SELECT id, name FROM temp.friends");
maxdb_stmt_execute($stmt);
/* get resultset for metadata */
$result = maxdb_stmt_result_metadata($stmt);
/* retrieve field information from metadata result set */
$field = maxdb_fetch_field($result);
printf("Fieldname: %s\n", $field->name);
/* close resultset */
maxdb_free_result($result);
/* close connection */
maxdb_close($link);
?>