PHP Classes

File: try.php

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

Contents

Class file image Download
<?
/*
This is the simplest example of an implementation of this class
*/
require ("class.search.php");

// change the information below to your needs
$try=new search_fields("hostname","username","password","databasename");
$table="tablename";
$cols=array("col1_name","col2_name", "col3_name");

// the stuff below here should not need to be changed to work
if ($submit<>"search") {
?>
<HTML>
<HEAD>
<TITLE>Search</TITLE>
</HEAD>
<BODY style='font-family:Arial,Helvetica,San-Serif;'>
<B>Search</B><BR>
<form action="<? echo basename($PHP_SELF) ?>" method="post">
    <BR>
I'll search by first name, last name, or city!<BR>
Enter search text: <INPUT TYPE="TEXT" NAME="terms">
<INPUT TYPE="hidden" Name="submit" value="search">
<button type="submit" name="sub_button">Search</button></FORM>
</BODY>
</HTML>

<?
} else {
?>
<HTML><HEAD><TITLE>Search Results</TITLE></HEAD>
<BODY style='font-family:Arial,Helvetica,San-Serif;'>
<?
$try
->set_AndOr("or");
$try->make_str($table,$terms,$cols);

// Match the keywords and display the result
$try->showresult();
?>
<BR><BR><A HREF="<? echo basename($PHP_SELF) ?>">Search Again</A>
</BODY>
</HTML>
<?
}
?>