It's not especially pretty and there isn't any error trapping, so please don't use this on any sort of production data. This will display the schema of a paradox data source....
/*
Paradox database schema display
Tim Burt
27/07/07
*/
//we're expecting a filename in the post vars
if ($_POST['database_name'] != "") {
//Set up anything we are likely to need
$database_filename = "".$_POST['database_name'];
echo "
Schema for ".$_POST['database_name']."
\n";if(!$pxdoc = px_new()) {
DIE("Problem !");
}
$fp = fopen($database_filename, "r");
if(!px_open_fp($pxdoc, $fp)) {
DIE("Couldn't open database file");
}
else {
//output the database schema...
$stock_schema = px_get_schema($pxdoc);
if (is_array($stock_schema)) {
foreach ($stock_schema as $key=>$value) {
echo "".$key." - Type ".$value['type'];
}
}
}
px_close($pxdoc);
px_delete($pxdoc);
fclose($fp);
}
else {
//show the form to get the filename
echo "
\n";echo "
Data Source Name (include extension) :
\n";echo "
\n";
echo "
\n";}
?>