Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Search Engine

    Im trying to build a small PHP Search Engine that just searches your site. I just want to specify what tables I want it to search and rank by word occurrence. I looked at some sites on how to build one but I had trouble with them. Can someone tell me how to build a small PHP search Engine in PHP? Im not asking for a super complex PHP Search Engine just one that will search your site.

  • #2
    Regular Coder xconspirisist's Avatar
    Join Date
    Jun 2006
    Location
    Great Britain.
    Posts
    138
    Thanks
    1
    Thanked 6 Times in 6 Posts
    IS your website based on databases much? If you're searching articles, for example, apply "fulltext" to the *content* field of each table in your database, and you can use a simple sql statement to rip rows from necessary tables.

    Search google for fulltext, there are loads of tutorials.

  • #3
    New Coder
    Join Date
    Jun 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Search Engine

    Thanks that helped, but what im looking for is more like just a php script that when you submit the query it searches the database and then prints the resultes.

  • #4
    Regular Coder xconspirisist's Avatar
    Join Date
    Jun 2006
    Location
    Great Britain.
    Posts
    138
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Well, if you perfect your query in phpmyadmin, then simply execute it like this:

    PHP Code:
    $sql "MY SEARCH QUERY";

    $result mysql_query($sql);
    $result mysql_fetch_assoc($result);

    if (
    $error mysql_error()) {
        die(
    $error);
    }

    print_r($result); 

  • #5
    New Coder
    Join Date
    Apr 2006
    Location
    UK
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think you would need to get the content out of each table that is specified, and then go through them to count the occurrences of the search term. maybe look for some downloadable search scripts to get some ideas of how they go about things.


  •  

    Posting Permissions

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