Twitters search returns all statuses with t开发者_StackOverflow社区he 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?
Use fulltext search or 3rd party software like sphinx, solr, lucene, ...
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.
精彩评论