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


Using the Form to Search

June 6, 2000

In the script above we have two general parsing functions that return a valid SQL comparison statement, these can be extended to cases in which we want to allow the use of operators such as: AND, OR, NOT, etc.

In this script, you saw the use of default values for some of the parsing functions parameters; this allows the invokation of the function with a variable number of said parameters. You will only need to specify the defaulted ones if you need to change them.

We will use the form to search for the keywords "image,reading, creating", in the title of articles written by Matias or Mark or Rasmus, with a publication date of 1999 or later. This will generate the following result:

Query Results

Saving your query for debugging purposes
You searched on articles with the words image,reading,creating in the title; written by Mark Musone OR Mattias Nilsson OR Rasmus Lerdorf published on or after 1999.
and it found: 3 rows
title author published length
IMAP Mail Reading With PHP3 Mark Musone 19990207200
Creating your own logfile Mattias Nilsson 19990302200
Image Creation With PHP Rasmus Lerdorf 19990124200

The form and the handling script can be modified to allow searching on more variables, or to search for keywords in the title and/or the body of the article, or even to retrieve a keyword matched in the body in a context (for example, get the 2 lines above and below the matching line).

Using a form like this gives control on the information the user can access, and reduces the number of possible SQL queries. If you type straight SQL, you can always make a query that can take (for practical purposes) an infinite amount of time to finish, something you may not want to happen in your site.

3 Different Types of Variables
So you want to use a database in your site?
Where To Go From Here


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