What kind of deal are you going for? A super-simple form/script that executes an SQL statement you type into the form might go something like this:
<FORM ACTION="executesql.php" ACTION="post">
<INPUT TYPE="text" NAME="query">
<INPUT TYPE="submit">
</FORM>
And executesql.php looking like:
<?
mysql_connect("localhost",'mydbusername','mydbpw');
mysql_select_db("mydb");
$result = mysql_query($query); // $query from the form
?>