Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Example 2: Parsing and querying

June 6, 2000

Here I will show a more complex example, which should make life easier for the user (who says the developer's life should be easy too :).

Example 2: Parsing and querying

In the first part of this article we made a straight, no syntax checking, SQL form interface to the database.

Now, I know that some people do not like to write raw SQL, so we will make a more "user-friendly" HTML form:

query_form.html

<HTML>
<TITLE>Query form</TITLE>
<BODY BGCOLOR="white">
<FORM ACTION="do_query.php3" METHOD="POST">

Find all documents in which:<BR>

the title contains any of these keywords: (*)
    <INPUT TYPE="text" NAME="title" SIZE=40>i<BR>
AND<BR>
was written by any of the following: (check as many as needed)<BR>
<INPUT TYPE="checkbox" NAME="author[]" VALUE="Mark Musone"> Mark Musone
<INPUT TYPE="checkbox" NAME="author[]" VALUE="Mattias Nilsson"> Mattias Nilsson
<INPUT TYPE="checkbox" NAME="author[]" VALUE="Rasmus Lerdorf"> Rasmus Lerdorf
<INPUT TYPE="checkbox" NAME="author[]" VALUE="Tim Perdue"> Tim Perdue
<BR>
AND<BR>
was published on or after the year:
<SELECT NAME="pubyear">
<OPTION VALUE="1999" SELECTED>1999</OPTION>
<OPTION VALUE="2000">2000</OPTION>
<OPTION VALUE="2001">2001</OPTION>
</SELECT>
<BR>
<INPUT TYPE="submit" NAME="submit" VALUE="Submit query">
</FORM>
(*) <I>Note</I>: You can enter a comma separated list of keywords, e.g.
"mail,imap,logging" will search for full or partial matches to:
<TT>mail OR imap OR logging</TT> in the title of the article.
</BODY>
</HTML>

Example 1: a simple SQL query interface
So you want to use a database in your site?
3 Different Types of Variables


Up to => Home / Authoring / Languages / PHP / Database




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers