How to sort my articles/content by Facebook Likes?

billyd

Regular Member
Joined
Jun 1, 2010
Messages
223
Reaction score
17
I have a site with articles/content that displays 4 per page. Each article has a Facebook Like button associated with it. How can I sort the page (I have PHP/MySQL) based on the number of Likes it has?
 
I think that you cant do it with php mysql. Unless you have stored the number of likes in your database. But i doubt it.

You should be able to do it with javascript.
Or you can parse the page with javascript and store the numbers in mysql and then nextime the page appears you can sort it with php/mysql.

Only problem would be if you have paging. Then you are screwed :-).

The best option would be using facebook API to get the numbers.
 
I think that you cant do it with php mysql. Unless you have stored the number of likes in your database. But i doubt it.

You should be able to do it with javascript.
Or you can parse the page with javascript and store the numbers in mysql and then nextime the page appears you can sort it with php/mysql.

Only problem would be if you have paging. Then you are screwed :-).

The best option would be using facebook API to get the numbers.

Is it possible to do with views (I keep track of the views in my sql db)
 
Back
Top