Pick up data from database via web-interface
Hello all.
I need an advice how to combine all these knowledge into one useful resource. I'd like to create a simple form which will allow to select soma data from the database via web-interface. I can create the database (let it be MySQL). I can create a HTML page with input forms/select fields/radio buttons and so on. I do not know PHP but try to consult a very nice website http://w3schools.com/php/php_mysql_select.asp So, I'm sure I will be able to write a simple PHP code, but it will be "static" - the query itself will be written inside the PHP code, with my hand. But I want the page be interactive - the user must be able to input some query or select some values from the list. So, I can't understand how to "connect" user's input with the query to the database. Maybe someone will give me a push to the right direction? :) Thanks. |
Not a direct answer to your question but please read up on sql injection before you start coding. I believe the preferred method to prevent injection is to use parameterised queries.
|
myschools is excellent ref, you'll end up coding sql chunks like "select " + $_POST['f1'] + "FROM " + $_POST['f2'] ..
Basically the easiest way is for your form/page to post to itself and have the php validate and run the post data. good luck |
Quote:
Kbp's point about being aware of SQL injection vulnerabilities clearly applies to you too. |
I agree, though i did mention
Quote:
|
All times are GMT -5. The time now is 07:04 PM. |