Log in

View Full Version : little coding help


Nemesis
03-31-2011, 05:30 PM
So for side projects I mess around witch scripts to help myself learn php. I am about finished with this face book 'my likes' site but the script originally has the top likes listed in order by the amount of times the page was viewed. I never really thought about it but a friend i was going to give the site to, to run, wants the top likes to be ordered by actual likes so as no one is to cheat the system by refreshing the page. I checked for a guide already on how to get that information from facebook to store in an sql database but couldn't figure it out. if anyone can help me learn thanks :) and here's what the site looks like http://melikey.net63.net/

so heres the code
#
<?
#
include('config/db_con.php');
#
mysql_connect("$host", "$username", "$password")or die("cannot connect");
#
mysql_select_db("$db_name")or die("cannot select DB");
#
$top = "SELECT * FROM `like` ORDER BY count DESC LIMIT 0, 100";
#
$new = mysql_query($top) or die(mysql_error());
#
while($rows = mysql_fetch_array($new)){
#
?>
#
<div style="clear:left;">
#
<div style="float:left;">
#
<fb:like layout="button_count" class="like_button" href="<?echo $site;?>like.php?like=<? echo $rows['id']; ?>"></fb:like>
#
</div>
#
<a href="<?echo $site;?>like.php?like=<? echo $rows['id']; ?>"><? echo stripslashes($rows['like']);?></a></div>
#
<?

ok so heres the code and up there you can see where the facebook like button code is <fb>. and you can see how it orders 100 of them in decending order but from the 'like' variable whitch is page views. How can i store the actual amount people hit liked and then retrieve that instead? again thanks for help and i hope i was clear enough:smile:

fadillzzz
04-01-2011, 02:29 AM
I checked for a guide already on how to get that information from facebook to store in an sql database but couldn't figure it out.


Can you give me the link to the guide you were referring to?

Nemesis
04-01-2011, 01:47 PM
oh sorry i actually never found a guide on how to do this. I was hoping someone would know, did you find a guide? if so could you show me it please? and thanks for helping.

fadillzzz
04-01-2011, 11:06 PM
Well I found this...

http://developers.facebook.com/

Nemesis
04-01-2011, 11:18 PM
yeah i came acrossed that. it doesn't seem possible becasue the button is an iframe so that data is on their servers. still other like sites have done it so idk. probably to much work..

thanks for trying though