

where the change is replacing UNION SELECT * FROM search_engine WHERE with OR: SELECT * FROM search_engine Since this looks like it's coming from the same database table, then you could combine it as follows. WHERE title LIKE '%$q%' OR link LIKE '%$q%' WHERE soundex(keyword) LIKE soundex('%$q%') It has 2 select statements, which are joined together with a UNION keyword. Principle".įirst, let's look at your SQL. This is good to remember, when writing code: Simple Always Wins. TIP #2: For searching, simpler is faster. That's usually what people are looking to do, when they want to add a "search feature" into their website. and display the results onto your search results page. You'd simply retrieve it from a database like: MySQL, PosgreSQL, Oracle, SQL Server, etc. If you want to add a product-based "search feature" to your website, then you don't need to extract content from an XML Sitemap. Or do you simply want to add a search box to your website, which gets product data from your product database & displays that product data on your website, with this idea: "I want to implement my own search feature into my website"? It may not be your end goal AKA what you really want to do.ĭo you really want to crawl the web, with this idea: "Extract all url from sitemap.xml with PHP CURL"?

Think about what you really want to do, before trying to build a search engine from scratch.

Pdf search engine php how to#
I'm going to give you 6 tips to explore, so that you can continue to learn how to program & proceed if desired.įirst define what you're trying to accomplish.
