Having a html form take sql statements and outputting them
What I'm trying to do is have a html form that allows anyone to type a sql query to my database and outputs the information on another page. So far I have the form working and the information carries over to my php page through POST and is stored in a variable like so:
$value = $_POST['query'];
$statement = $database->prepare($value);
So for instance if I had a movie database the user could type their own statement like SELECT * movie.name FROM MOVIES; and see results. The problem I'm having trouble with is that the user can type whatever statement they wish and, maybe even INSERT new information. I'm wondering how do I output the results on another page.
So far the only thing I came up with is to loop through the results and output but I have no way of knowing how many rows will be present because of how dynamic a query can be.
链接地址: http://www.djcxy.com/p/46204.html上一篇: 上传,为什么比原来大?