Save the rank in the DB
I'm using this query to classify pages for which users vote for :
SELECT p.page_ID , h.point
FROM pages p
INNER JOIN history h ON h.page_ID=p.page_ID
ORDER BY h.point DESC
So I know how to display my pages开发者_StackOverflow ranking, but I'd like to save the rank of each page in my table. How do ?
Assuming you have in PHP $rank
as the rank value and $pageid
as the page_ID
you wish to update (and assuming they're both integers not requiring quotes):
UPDATE history SET point=$rank WHERE page_ID=$pageid;
Or if the page does not already exist in the history
table:
INSERT INTO history (page_ID, point) VALUES ($pageid, $rank);
精彩评论