It is quite POSSIBLE to submit SQL statements via a web browser. 

It sounds to me like all you want is a simple ad-hoc query processor. If so, all 
you need is a relatively simple perl or php script (or whatever language you want) 
which executes your ad-hoc query and returns the result.  

PHP example (untested, stripped down version of the script I use):

<?php  // query.php    

// calling syntax:
// http://yourdomain.com/query.php?query=select * from table1

 $sock = mysql_connect("localhost", "username", "password");
 mysql_select_db("database",$sock);
 $query = stripslashes($query);
 $res = mysql_query($query,$sock);
 if (!$res)
   { echo("ERROR: ".mysql_error($sock)." ".__FILE__); exit; }
 $row = mysql_fetch_row($res);
 if (strlen($row) == 0)
   { echo("NO DATA found matching request"); exit; }
 echo("<table><tr>");
 $numcols = mysql_num_fields($res);
 for ($i=0; $i < $numcols; $i++) // output field names
   { echo("<th>".mysql_field_name($res, $i)); }
 while (strlen($row))
   {
     echo("<tr>");
     for ($i=0; $i < $numcols; $i++) 
       { echo("<td>".$row[$i]); } // output data
     $row = mysql_fetch_row($res);
   }
  echo("</table>");
}
?>

You will have to modify the first two lines with your username, password, and 
database name. Depending on what you need you could get away with even less code.
 
I warn you that this is a dangerous script because anyone who discovers it could 
send damaging SQL statements to it, such as 
"DELETE FROM table1" or DROP DATABASE.  You can protect it in a variety of ways 
such as: put it in a password protected directory, have it test for and reject 
operations you don't want to happen, 
require additional parameter(s) which validate the user, etc.

--Richard



> I agree but this one one of those things which _SHOULD_ have been
> researched.
> 
> denonymous wrote:
> > 
> > From: "Colin Faber" <[EMAIL PROTECTED]>
> > 
> > > Rw wrote:
> > > >
> > > > Is it possible to access a sql statement to mysql database through
> > > > Internet explorer ? such as :
> > >
> > > No,
> > >
> > > MySQL is not a web server.
> > 
> > Well, it's not an entirely invalid question...
> > One example that comes to mind is accessing ftp://, gopher://, news://, etc
> > from a web browser.
> > 
> > Seems like a fairly valid newbie question to me, especially if one is not
> > versed in protocols.
> > 
> > --
> > denonymous
> > www.coldcircuit.net
> > 
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> > 
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> -- 
> Colin Faber
> (303) 859-1491
> fpsn.net, Inc.
> 



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to