PHP Classes

File: search.php

Recommend this page to a friend!
  Classes of Joe Stump   Miester Search   search.php   Download  
File: search.php
Role: ???
Content type: text/plain
Description: An example search page
Class: Miester Search
Author: By
Last change:
Date: 23 years ago
Size: 3,000 bytes
 

Contents

Class file image Download
<HTML> <BODY BGCOLOR="white"> <? set_time_limit(0); // error_reporting(0); include('./search.config'); include('./db.obj'); include('./search.obj'); ?> <FORM METHOD="post" ACTION="<? echo $PHP_SELF; ?>"> <INPUT TYPE="text" NAME="query" VALUE="<? echo $query; ?>"> &nbsp;<INPUT TYPE="submit" NAME="submit" VALUE="Search!"> </FORM> <? if($query) { $search = new Search($tables); $search->set_query($query); // Remember to add additional tables here - this determines which tables the // sql will be built for. $search->BuildSQL(array('news_information','link_information','news_feeds','message_replies','message_threads')); // $search->BuildSQL(array('news_information','link_information')); // an array of SQL queries indexed by table names $sql = $search->return_query_sql(); while(list(,$string) = each($sql)) { echo $string.'<p>'; } reset($sql); $db = new DB(); // no limits are set - that's up to you $db->set_sql($sql['news_information'].' LIMIT 0,10'); if($db->select_query()) { echo '<h2>News:</h2><hr>'.$sql['news_information'].'<hr>'; while(list(,$row) = each($db->rows)) { echo '<b>'.$row['newsTitle'].'</b><br>'; echo $row['newsText'].'<p>'; } } $db->set_sql($sql['link_information'].' LIMIT 0,10'); if($db->select_query()) { echo '<h2>Links:</h2><hr>'.$sql['link_information'].'<hr>'; while(list(,$row) = each($db->rows)) { echo '<b><a href="'.$row['linkURL'].'">'.$row['linkTitle'].'</a></b><br>'; echo $row['linkInfo'].'<p>'; } } $db->set_sql($sql['news_feeds'].' LIMIT 0,10'); if($db->select_query()) { echo '<h2>News Feeds:</h2><hr>'.$sql['news_feeds'].'<hr>'; while(list(,$row) = each($db->rows)) { echo '<b><a href="'.$row['articleURL'].'">'.$row['articleTitle'].'</a></b>'; if($row['articleText']) { echo '<br>'.$row['linkInfo'].'<p>'; } else { echo '<br>'; } } } $db->set_sql($sql['message_threads'].' LIMIT 0,10'); if($db->select_query()) { echo '<h2>Message Threads:</h2><hr>'.$sql['message_threads'].'<hr>'; while(list(,$row) = each($db->rows)) { echo '<b><a href="/simple_boards/threads/'.$row['threadID'].'">'.$row['threadSubject'].'</a></b>'; echo '<br>'.$row['threadBody'].'<p>'; } } $db->set_sql($sql['message_replies'].' LIMIT 0,10'); if($db->select_query()) { echo '<h2>Message Replies:</h2><hr>'.$sql['message_replies'].'<hr>'; while(list(,$row) = each($db->rows)) { echo '<b><a href="/simple_boards/replies/'.$row['replyID'].'">'.$row['replySubject'].'</a></b>'; echo '<br>'.$row['replyBody'].'<p>'; } } } ?> </BODY> </HTML>