thanks for your reply,
What i was after is a way of representing the data, given that you dont know
what columns will be displayed and how many rows etc?
I would only be looking to do 'selects' so how can i ensure that this is the
only type of query run?
Thanks for your help
"Ronan Chilvers" <[EMAIL PROTECTED]> wrote in message
> Hi Shaun
> Comments inline ...
> On 01 Apr,2003 at 13:37 shaun shaun wrote:
> > Hi,
> > I would be very interested to see an example of how it would be possible
> > enter a query into a text area and the results of the query displayed on
> > next page, similar to PHP admin I guess, are they any examples out
> Fairly simple At its most basic you have a form :-
> <form method="post" action="do_query.php">
> <textarea name="myquery"></textarea>
> <input type="submit" name="submit" value="Submit">
> which posts to your php page :-
> $sql = $HTTP_POST_VARS["myquery"];
> // You'll need code here to sanitize the query and make sure there's
> // no nasty surprises in it.
> // then simply create your connection (assuming a function here)
> $conn = db_connect();
> $result = mysql_query($sql);
> // Code to display the result here
> You would need to have some checking involved for the query. Also, as
always, apply 'least privilege' to the user the query runs as. I don't know
what you're using it for but be VERY careful - I would only allow selects
here unless you're sure you know how it will be used.
> Hope this helps ... :-)
> e: [EMAIL PROTECTED]
> t: 01903 739 997
> w: www.thelittledot.com
> The Little Dot is a partnership of
> Ronan Chilvers and Giles Webberley
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php