Welcome to the Interactive SQL Query System

MYHEAD; echo $myhead; $host="bidu.lab.ic.unicamp.br"; $sgbd="mysql"; //or oracle, mysql, firebird $user="scott"; $password="tiger"; $server="test"; // or winestore echo "SGBD: $sgbd       User: $user      Database: $server       $now

"; switch ($sgbd){ case 'postgres': $host=''; break; } $conn = &ADONewConnection($sgbd) or die("ADDONewConnection($sgbd) failed"); $conn->autoRollback = true; $conn->Connect($host,$user,$password,$server) or die ("Could not connect.."); $query="show tables"; print "Your SQL command:

"; print "

$query
"; if ($query=="show tables"){ echo "

Tables in Database $server:

"; $meta= $conn->MetaTables(); }//if /* Performing SQL query */ $stmt= $conn->Execute($query) or die($conn->ErrorMsg()); $ncols= $stmt->FieldCount(); $nrows = 0; print "Results:

"; for ($i=0; $i< $ncols; $i++){ $fld= $stmt->FetchField($i); $col_name[$i]= $fld->name; $type[$i]= $stmt->MetaType($fld->type); $len[$i]= $fld->max_length; } /* Printing results in one HTML table: */ print ''; print ""; for ($i=0; $i< $ncols; $i++){ print ""; } print "\n"; print ""; while( ($r= $stmt->FetchRow())){ $nrows++; for ($i=0; $i< $ncols; $i++){ $col_value= $r[$i]; if ($col_value =="") $col_value=" "; if($type[$i]=='N' or $type[$i]=='I' or $type[$i]=='R' or $type[$i]=='X') print ""; else print "\n"; } //for print "\n"; } // while print "
$col_name[$i]
$col_value$col_value
\n"; print "

$nrows rows returned by your SQL command"; print ""; ?>