paulmo Posted December 23, 2008 Share Posted December 23, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/138095-php-or-mysql-for-interpreting-text-field-input/ Share on other sites More sharing options...
MadTechie Posted December 23, 2008 Share Posted December 23, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/138095-php-or-mysql-for-interpreting-text-field-input/#findComment-721864 Share on other sites More sharing options...
paulmo Posted December 23, 2008 Author Share Posted December 23, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/138095-php-or-mysql-for-interpreting-text-field-input/#findComment-721897 Share on other sites More sharing options...
trq Posted December 23, 2008 Share Posted December 23, 2008 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/138095-php-or-mysql-for-interpreting-text-field-input/#findComment-721924 Share on other sites More sharing options...
paulmo Posted December 23, 2008 Author Share Posted December 23, 2008 is it appropriate to ask if you might please offer some basic structure as to how i'd get that going? beyond yes or no? thanks Quote Link to comment https://forums.phpfreaks.com/topic/138095-php-or-mysql-for-interpreting-text-field-input/#findComment-722231 Share on other sites More sharing options...
Yesideez Posted December 23, 2008 Share Posted December 23, 2008 $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" Quote Link to comment https://forums.phpfreaks.com/topic/138095-php-or-mysql-for-interpreting-text-field-input/#findComment-722234 Share on other sites More sharing options...
paulmo Posted December 23, 2008 Author Share Posted December 23, 2008 thank you yesideez. i'll put this concept into practice and post the results. cheers, paulmo Quote Link to comment https://forums.phpfreaks.com/topic/138095-php-or-mysql-for-interpreting-text-field-input/#findComment-722574 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.