File: try2.php

Recommend this page to a friend!
  Classes of Craig Heydenburg  >  better_field_search  >  try2.php  >  Download  
File: try2.php
Role: Example script
Content type: text/plain
Description: second example
Class: better_field_search
Generalized, flexible class to search a mysql DB
Author: By
Last change:
Date: 19 years ago
Size: 1,502 bytes



Class file image Download
// this is an exmple showing the use of the get_field_names function and
// its usefulness.
This is a sample of how to implement the class.
The class was originally written by
Sujith Nair []
On September 12, 2001

greatly modified and enhanced by
Craig Heydenburg []
May 14, 2002
require ("");

// change the information below to suit your needs
$try=new search_fields("hostname","username","password","dbname");
// end

if ($submit<>"search") {
<BODY style='font-family:Arial,Helvetica,San-Serif;'>
Select the fields you would like to search in and display:<BR>
<form action="<? echo basename($PHP_SELF) ?>" method="post">
<? while (list($k,$v)=each($try->get_field_names($table))) {
        print (
"<INPUT TYPE='checkbox' NAME='cols[".$k."]' value='".$v."'> ".$v."<BR>");
Enter words or title: <INPUT TYPE="TEXT" NAME="terms">
<INPUT TYPE="hidden" Name="submit" value="search">
<button type="submit" name="sub_button">Search</button></FORM>

} else {
<HTML><HEAD><TITLE>Search Results</TITLE></HEAD>
<BODY style='font-family:Arial,Helvetica,San-Serif;'>

// Match the keywords and display the result
<BR><BR><A HREF="<? echo basename($PHP_SELF) ?>">Search Again</A>

For more information send a message to info at phpclasses dot org.