I'm looking for a script, functioning like the Google homepage that fetches data from a database rather than the internet.

This is not intended to be a search engine, but a repository of jokes that can be pulled depending on the keywords typed. No sophisticated search techniques are required - keyword based is perfectly fine.

If some mechanism of up/down-voting jokes can be incorporated, that would be fantastic, but I'm presuming that will be an entirely different game.

  • Any specific reason why it needs to be MySQL or PHP? If it's because you know those two platforms (even if you're still learning), I would suggest just trying to build it yourself. It wouldn't be too hard. And any problems you run into you can ask a question on the StackOverflow site. This might be easier than finding a script. Here's a tutorial on creating a basic MySQL fulltext search to get you started: devshed.com/c/a/MySQL/… Jan 24 '11 at 15:02
  • @Lèse, @Don - I'm trying to have the front page as a mock "Google-like" page with one simple search box there. Its a satire page of sorts... :) I'm familiar with MySQL/PHP, so its easier to get off the ground with those... and my hosting provider doesnt do ruby/etc.
    – siliconpi
    Jan 25 '11 at 3:48
  • Did you find what you were looking for? Feb 14 '11 at 19:35
  • @Christopher - not really, i ended up outputting jokes in a bare-bones google-results formet... :)
    – siliconpi
    May 7 '11 at 10:28

Couldn't you use a CMS system that indexes the content full text? I've not used them extensively, but I think Joomla or Drupal may be all you need.

You'd have to determine who you want to be able to post and such though.


  • no, not really. See my comment above below the main question please...
    – siliconpi
    Jan 27 '11 at 3:49
  • So if I follow...you want to not necessarily return a search that MATCHES what's typed, but rather return a JOKE that is kind of "typed" to what was entered, so if I search for "programming tips" it may use "programming" to return a joke on Java, PHP, etc.? If that's the case, I think you'd have to loop over the words entered in the search and then run each keyword against another table of jokes that has a full text indexed column of keywords, so your php joke would have "programming" as one of the keywords in this column... just brainstorming here...
    – digit1001
    Feb 8 '11 at 15:59

Have you checked out Sphinx or Solr? Both are relatively easy to use, very flexible and work with php. Here's the link to search engine extensions for PHP it has several options if I were you I'd pick one and test it out.



I don't know of any components already out there. If you were to do this yourself, there are a couple of different methods. The first is a simple fulltext search on your database. This answer on Stack Overflow explains. With fulltext indexes on your fields this wouldn't be particularly inefficient, at least with smaller databases.

A better way would be to index every word from every joke (excluding common words like 'the'). You'd need a table of words with id|word and a mapping table of wordid|jokeid. Whenever you added a joke, get all the individual words and store the mapping. Then when searching, find all jokes containing each word of the search term and combine and rank results how you wish.

There is also the option of using a CMS like Joomla/Wordpress. They come with search modules to search your site pretty easily.


You could use WordPress, categorize and tag the jokes, it has a built in search feature. All the plugins you could want for voting up and down posts, liking them etc, integrate with facebook and twitter etc. You would save a lot of time programming if you worked with a CMS that can already do everything you want and more. You can easily modify the index or home template to look however you want, and the output results again can be customized with CSS.


You could use http://www.question2answer.org/ , it's a Q&A but by your description it fits perfectly, you would just have to make a theme (which is fairly simple and the system have some ready to use) and comment out the features you don't want (registration, comments)...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.