function getFavoriteCount()
 {
     $sql = "SELECT tweet.text, tweetpopularity.favoriteCount FROM `tweetpopularity` \n\t\t\t\t\tINNER JOIN tweet ON tweetpopularity.tweetId = tweet.tweetId \n\t\t\t\t\twhere favoriteCount != 0 group by favoriteCount limit 10 offset 10";
     $twitterDB = new TwitterDB();
     $conn = $twitterDB->getDBConnection();
     $result = $conn->query($sql);
     $tweets = array();
     if ($result->num_rows > 0) {
         // output data of each row
         $i = 0;
         while ($row = $result->fetch_assoc()) {
             $tweets[$i]["text"] = $row["text"];
             $tweets[$i]["favoriteCount"] = $row["favoriteCount"];
             settype($tweets[$i]["favoriteCount"], "integer");
             $i++;
         }
     }
     $twitterDB->closeDBConnection($conn);
     return $tweets;
 }
Exemple #2
0
<html>
<head>
<?php 
include 'TwitterDB.php';
include 'Chart.php';
$twitterDB = new TwitterDB();
//$twitterDB->printArray($_SERVER);
$chart = new Chart('PieChart');
$options = array();
if (!empty($_GET) && isset($_GET) && array_key_exists('charts', $_GET) && !empty($_GET['charts'])) {
    $flag = false;
    if ($_GET['charts'] == 'retweetcount-vs-text') {
        $flag = true;
        $data = $twitterDB->getRetweetCountAndText();
        $chart->load($data, 'array');
        $options = array('title' => 'How many times a tweet is retweeted limited to 10.', 'is3D' => true, 'width' => 500, 'height' => 400);
    } else {
        if ($_GET['charts'] == 'different-days') {
            $flag = true;
            $data = $twitterDB->getTweetsOfDifferentDays();
            $chart->load($data, 'array');
            $options = array('title' => 'Different days tweets analytics', 'is3D' => true, 'width' => 500, 'height' => 400);
        } else {
            if ($_GET['charts'] == 'status-source') {
                $flag = true;
                $data = $twitterDB->getStatusSource();
                $chart->load($data, 'array');
                $options = array('title' => 'Different types of sources used to tweet', 'is3D' => true, 'width' => 500, 'height' => 400);
            } else {
                if ($_GET['charts'] == 'favorite-count') {
                    $flag = true;