Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010

    Unanswered: search script, witch functions ?


    I would like to build mini search system.
    I have one column in DB,
    i choose correct rows by "against match" query,
    and i want to display result in short way.

    Example should tell what I mean:

    $searchString = "aaaa bbbb cccc";

    sdsdssdsd aaaa dsd sdsd sd aaaa bbbb dsdsd ... asas bbbb dsfe ...
    dsdsd bbbb cccc dsdsd ... asas bbbb dsfe ....

    It's like in google search, where desctription of site are show.

    I will be glad for working script to do it
    or just a helpful function, class etc.

    Peace <3

  2. #2
    Join Date
    Aug 2010
    PHP Code:
    <form name="search" method="post" action="<? echo $PHP_SELF; ?>">
    <table width="331" border="0">
    <td width="76">Keyword:</td>
    <td width="245">
    <input type="text" name="keyword">
    <input type="submit" name="Submit" value="Search">

    PHP Code:
    mysql_connect("localhost","username", "password");

    if($Submit == "Search"){
    echo"Tėm kiếm <b>$keyword</b><br><br>";

    $result=mysql_query("SELECT * FROM `table` WHERE 1 AND `username` LIKE '$keyword%'");

    while($row = mysql_fetch_array($result, MYSQL_ASSOC)){

    printf("%s<br>", $row["username"]);
    /* Kết quả */

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts