Reputation: 1178
Twitters search returns all statuses with the word used in the search query. I'm just wondering how i could do this in PHP so it would only display the mysql entrys with that word in it?
Upvotes: 0
Views: 211
Reputation: 503
Use a while loop on your result resource after making the database connection and echo out all the records one by one. Your query should look something like the one below depending on what the user entered. You should also echo at least a <br>
between each loop!
SELECT * FROM tweets WHERE text LIKE '%word%';
Will show you all the tweets with 'word' in it.
Edit:
Since you are just trying to match on a word and not duplicate twitter's search algorithm, to get up and running the quickest use mysql's full text search. Thank you zerkms.
Upvotes: 0
Reputation: 254975
Use fulltext search or 3rd party software like sphinx, solr, lucene, ...
Upvotes: 2