LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-08-2012, 12:46 AM   #1
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361
Blog Entries: 3

Rep: Reputation: 48
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.

Last edited by Lexus45; 03-08-2012 at 12:47 AM.
 
Old 03-08-2012, 06:09 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
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.
 
Old 03-14-2012, 07:47 AM   #3
adixon
Member
 
Registered: Oct 2010
Posts: 34

Rep: Reputation: 3
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
 
Old 03-14-2012, 08:44 AM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by adixon View Post
you'll end up coding sql chunks like "select " + $_POST['f1'] + "FROM " + $_POST['f2'] ..
* ahem

Kbp's point about being aware of SQL injection vulnerabilities clearly applies to you too.
 
Old 03-14-2012, 08:53 AM   #5
adixon
Member
 
Registered: Oct 2010
Posts: 34

Rep: Reputation: 3
I agree, though i did mention
Quote:
php validate and run the post data
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
WiFi interface will no longer pick up an IP address from access point. DiBosco Linux - Wireless Networking 4 12-22-2007 06:42 PM
Processing data from a 'foreign' database with mysql, or tools to pre-process data. linker3000 Linux - Software 1 08-14-2007 08:36 PM
Data from web form to SQL database crazydark Programming 5 03-14-2007 01:37 AM
make a database and interface is web browser wood Programming 4 01-30-2004 06:35 AM
Web Interface for File Database ghight Linux - Software 1 10-01-2003 01:55 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration