<html>
<head>
<title>DB2 Query</title>
<link href="/styles/cs1.css" rel="stylesheet">
</head>
<body>
<h1>DB2 Query</h1>
This form allows general SQL queries to be passed to DB2.<br>
<?php //only for on campus use
require('ismcm.pinc');
if (! isMcmurry() ) {
print "<big><em>This is only available from the McMurry network</em></big>";
exit;
} ?>
<!-- Form part. Note we keep the query if we've made one -->
<form method="post">
<textarea name="query" rows="4" cols="60" >
<?php
if (isset($query)){
$query = StripSlashes($query); //Webserver? adds slashes to the queries
// take them out
print "$query";};
?>
</textarea><br>
<input type="submit" value="Query">
</form>
<hr>
<?php
// processing the form
if (isset($query)) { //do we have a query?
print "<h2>Results</h2>\n";
print "<p>query: <code> $query </code></p>\n";
// connecting as the user webserver runs as
$user="";
$passwd="";
if (! ( $conn= @odbc_pconnect("DBMS",$user,$passwd)) ) {
Print "Bad connection";
exit;
};
// execute query
$result = odbc_exec($conn, $query);
// show results
if ($result) { odbc_result_all($result, "border = 1" ); };
}
?>
</body>
</html>