php search of site

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
panamaszr12
Forum Newbie
Posts: 1
Joined: Fri Oct 10, 2003 8:57 am

php search of site

Post by panamaszr12 »

I am new to php and have seen a person can use it to do a site search. My problem is I have never built anything like this so I could use a tutorial or some advice. I need to an automatic index, and a simple search. My site is on a windows 2000 server and has asp pages in it, but I have setup the pages in html format.
User avatar
wmasterj
Forum Commoner
Posts: 40
Joined: Mon Aug 18, 2003 5:52 pm
Location: Stockholm, Sweden

Post by wmasterj »

the way you search the sites, the ones i know atleast:
- having the information in a database and search that
- open every html file and search the information within the html page, although that's quite a thing to create, specially if your new to php

otherwise here's a tutorial:
http://www.zend.com/zend/tut/tutorial-Ferrara.php - for searching MySQL database with PHP.
http://se.php.net/manual/en/function.file.php - for searching *.html files
murph
Forum Commoner
Posts: 29
Joined: Fri Oct 03, 2003 1:28 pm
Location: washington

Post by murph »

Well it depends if you want the user to search for something specific or just some text on a page. You can make a database that the user can search through. or if you want the user to be able to search a html document just load that file up in an array and search through the array for the search text. if the search text is found then output a link to that html document.
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

searching thru every page is odd and slow, u have to make a 'page reader', read all the pages and add the words in a database and refer them to the page it corresponds... like

Code: Select all

page  |words
----------------------------------------------
m.php |go click wait mine jump squeeze
r.php |something bad good wrong
and then search in every record for the words
etc etc
Post Reply