Top X-posts of the past week? SQL/PHP [figured it out] -


How do I get the top x posts of the past week? I have two tables: td_table - keeps information about the post; Vote_table - Keeps information about the votes made for posts. The following gives me the top three posts (for whom the most votes are), but it gives me three times at the top.

  $ query = 'SELECT t.id, t.content, T.userid, t.time fROM tb_table, (SELECT *, count (*) as voted_id ORDER by VoteTable group Is numbered by) u ou u.vote_id = t.id LIMIT 3 ';  

I tried to use something like this:

  SELECT * FROM vote_table WHERE t.time & gt;  

But whenever I add such a condition to the above query, it either dies (if I add it to choose from the VoteTotal label)) or this is an empty page load (If it is and where the situation is last) ...

So ... how can I add those people? Call all information from the query, but only those voters who have been made for the last week?

understand it! By using

 _time & gt; = (UNIX_TIMESTAMP () - ((60 * 60 * 24) * 7))  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -