Created
September 18, 2013 11:29
-
-
Save sriannamalai/6607860 to your computer and use it in GitHub Desktop.
Code to calculate the Virality of Social Networks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$social = "TWITTER"; | |
$result1 = mysql_query("SELECT * FROM table3") or die("Cannot get the results!"); | |
$visits = mysql_num_rows($result1); | |
$result2 = mysql_query("SELECT * FROM table3 WHERE SOCIAL_SITE='".$social."'") or die("Cannot get the results!"); | |
$clicks = mysql_num_rows($result2); | |
$virality = $clicks / $visits * 100; | |
echo $social.": Clicks ".$clicks." of visited ".$visits." has the Virality of <b>".$virality."%</b>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment