View Single Post
  #1  
Old 03-31-2011, 05:30 PM
Nemesis's Avatar
Nemesis Nemesis is offline
Member
 
Join Date: Mar 2011
Location: Ohio, United States
Posts: 641
Gender: Male
Credits: 50,772
Nemesis is on a distinguished road
Default little coding help

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
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
Reply With Quote