Login   Register  
PHP Classes

File: try2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 12 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.search.php class.
The class was originally written by
Sujith Nair [sujith_77@hotmail.com]
On September 12, 2001

greatly modified and enhanced by
Craig Heydenburg [craigh@mac.com]
May 14, 2002
require ("class.search.php");

// 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>