virtual("../top.txt") ?> mysql_connect ("localhost", "web", "guest") or die("Unable to connect to SQL server"); mysql_select_db("abbott") or die("Unable to select database"); if ($display == null) { $display = date; } ?>
Search results for " echo $search ?>" if ($search == null) { echo("Please enter a search value"); } else { $search = trim($search); $search = strtr($search," ","%"); $searchArray = explode("%",$search); $searchString = "select id,date from times_letters where "; while ($term = current($searchArray)) { $searchString .= "(who like '%$term%' or subject like '%$term%' or date like '%$term%' or actual like '%$term%') $bool "; next($searchArray); } if ($bool == "AND") { $searchString .= "1"; } else { $searchString .= "0"; } if ($field == "default") { $results = mysql_query($searchString); } else { $results = mysql_query("select id,date from times_letters where $field like '%$search%' ORDER BY date"); } while($result = mysql_fetch_array($results)) { srand ( (double) microtime()*10000000); $num = rand(0,9999); define(SEARCHID, (int)$num); $reslist[] = $result['id']; ?> echo $result['date']; ?> } if ($reslist != null) { $res = ""; $res .= current($reslist); while($elt = next($reslist)) { $res .= ("," . $elt); } $searchid = SEARCHID; mysql_query("insert into sbuffer (id,result) values ($searchid,'$res')") or die("Insert failed!"); mysql_Query("delete from sbuffer where TIME_TO_SEC(stamp) < (TIME_TO_SEC(CURTIME()) - 3600)"); } else { ?> No matches found. }} ?> |