Search multiple keywords from text file database
Posted: Tue Nov 03, 2009 5:54 am
Search multiple keywords from text file database
I have a text file database:
webdatabase.txt
------------------------------------------------------------------------------
1257143509||google web search||Enables users to search the Web, Usenet, and images||www.google.com->
1245876563||yahoo portal||free Yahoo! Mail & Instant messenger, news, finance||www.yahoo.com->
1254555967||MSN Live||Microsoft's portal, offering MSNBC News, search, sports, MSN Money||www.msn.com
------------------------------------------------------------------------------
The above text file database has column separator ||, and row separator as ->
The first column, generated from time() function, can be used as primary key.
I want to search several keyword(S) and the program will open
webdatabase.txt to search the keyword(S) from column1 and column2. Column0 and column3 need not to search.
Display the rows in DESC order. More occurrence to less occurrence.
Example: If anyone enter: web money
output will be:
1257143509||google web search||Enables users to search the Web, Usenet, and images||www.google.com
then
1254555967||MSN Live||Microsoft's portal, offering MSNBC News, search, sports, MSN Money||www.msn.com
(Without column separator)
Example 2: If anyone enter: Instant messenger portal
Display: 1245876563||yahoo portal||free Yahoo! Mail & Instant messenger, news, finance||www.yahoo.com
1254555967||MSN Live||Microsoft's portal, offering MSNBC News, search, sports, MSN Money||www.msn.com
-- Advance Thanks for your help
I have tried lots of code but getting 2 problems 1. Several keywords 2. Display the whole row in pagination format. I am not sending my php code yet as I want to see the different approach and concept.
- Thanks again and waiting for reply.
[Note: I promise, next time I will do in mysql database]
I have a text file database:
webdatabase.txt
------------------------------------------------------------------------------
1257143509||google web search||Enables users to search the Web, Usenet, and images||www.google.com->
1245876563||yahoo portal||free Yahoo! Mail & Instant messenger, news, finance||www.yahoo.com->
1254555967||MSN Live||Microsoft's portal, offering MSNBC News, search, sports, MSN Money||www.msn.com
------------------------------------------------------------------------------
The above text file database has column separator ||, and row separator as ->
The first column, generated from time() function, can be used as primary key.
I want to search several keyword(S) and the program will open
webdatabase.txt to search the keyword(S) from column1 and column2. Column0 and column3 need not to search.
Display the rows in DESC order. More occurrence to less occurrence.
Example: If anyone enter: web money
output will be:
1257143509||google web search||Enables users to search the Web, Usenet, and images||www.google.com
then
1254555967||MSN Live||Microsoft's portal, offering MSNBC News, search, sports, MSN Money||www.msn.com
(Without column separator)
Example 2: If anyone enter: Instant messenger portal
Display: 1245876563||yahoo portal||free Yahoo! Mail & Instant messenger, news, finance||www.yahoo.com
1254555967||MSN Live||Microsoft's portal, offering MSNBC News, search, sports, MSN Money||www.msn.com
-- Advance Thanks for your help
I have tried lots of code but getting 2 problems 1. Several keywords 2. Display the whole row in pagination format. I am not sending my php code yet as I want to see the different approach and concept.
- Thanks again and waiting for reply.
[Note: I promise, next time I will do in mysql database]