RE: PHP search

From: Peter Marko (marko@limba.sk)
Date: 26. 07. 2002, 13:13 CEST


> Dik, ked ja by som potreboval nejaky kompletny example, stranka s 
> formularom, kod, vysledok.
> Na fulltext.
> 
> Bobo

form.htm

*********

<html><body><form action="./search.php" method="post"><input type="text"
name="hladaj"><input type="submit"></form></body></html>

*********

search.php

************

<?
@$db_con = mysql_pconnect('localhost','user','password');
If (!$db_con) die("chyba")
If (!mysql_select_db('database_name',$db_con)) die("chyba");

$strSQL = 'SELECT ID, String_Field, MATCH (String_Field) AGAINST
(\''.$hladaj.'\') As Score FROM table_name WHERE MATCH (String_Field)
AGAINST (\''.$hladaj.'\')';
$res = mysql_query($strSQL, $db_con);
while ($row=mysql_fetch_array($res)) echo $row['ID']."
".$row['String_Field']." ".$row['Score']."<br>";
?>

dufam, ze som sa nikde nepomylil a script funguje ;-)

peter



This archive was generated by hypermail 2.1.2 : 26. 07. 2002, 13:13 CEST