Jump to content

Recommended Posts

i'm wondering which is better, php or mysql database, to search for certain key words from user submitted text form, and return text answers based on the key words? like if "tree" were one of the words, a passage uploaded to database table (or in php page?) about trees would be echoed. and if "my tree" were submitted, "your tree..."etc. would be echoed. in other words, need php or mysql to "read" the user submitted text.

 

how to begin to do this? thanks.

Hummm... Well if my PHP you mean returning all records from a database then looping until you find it or reading from a text file then i would say MySQL.. PHP works well with MySQL its designed for holding data and allowing searched also on the server its better to divide the tasks to again MySQL.. thats if i understand your question

yes thank you that's along the lines...except matching user submitted text form key words with those words in db files (not just searching db files alone). also could multiple words be searched in same user submitted text and associated database files be echoed according to order of importance of words?

 

 

$query=mysql_query("SELECT * FROM table WHERE field LIKE '%sometext%'");

 

%sometext% = search with "sometext" anywhere inside "field"

sometext% = search with "sometext" at the end of "field"

%sometext = search with "sometext" at the start of "field"

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.