<?php require_once 'header.php'; $jsonOut = getJSONOutput($con, $userid); function getJSONOutput($con, $id) { $selectUser = "******"; $userResult = mysqli_query($con, $selectUser) or die("Error gettings user data: " . mysqli_error($con) . "<br>{$selectUser}"); $out['cols'] = array(array("id" => "a", "label" => "Date", "type" => "datetime"), array("id" => "b", "label" => "Followers", "type" => "number"), array("id" => "c", "label" => "Following", "type" => "number")); $x = 0; while ($row = mysqli_fetch_array($userResult)) { $year = date("Y", strtotime($row['Created_at'])); $month = date("m", strtotime($row['Created_at'])) - 1; $day = date("d", strtotime($row['Created_at'])); $hour = date("H", strtotime($row['Created_at'])); $minutes = date("i", strtotime($row['Created_at'])); $seconds = date("s", strtotime($row['Created_at'])); $user = array(); $user[] = array("v" => "Date({$year}, {$month}, {$day}, {$hour}, {$minutes}, {$seconds})"); $user[] = array("v" => intval($row['NoFollowers'])); $user[] = array("v" => floatval($row['NoFollowing'])); $rows[$x] = array("c" => $user); $x++; } $out['rows'] = $rows; return json_encode($out); } ?> <!DOCTYPE html> <html> <head>
<?php require_once 'header.php'; $jsonOut = getJSONOutput($con, $_GET['id']); $selectPost = "SELECT a.IG_PostID, b.Created_at, a.Link, a.ImageLowResolution, a.VideoStandardResolution, a.CaptionText, a.Filter, a.Type, a.IG_Created_at, b.TagCount, b.CommentCount, b.LikeCount, b.UsersInPhoto\n\t\tFROM `Posts` as a, PostData as b\n\t\tWHERE a.IG_PostID = b.IG_PostID AND a.IG_PostID = '" . $_GET['id'] . "'\n\t\tORDER BY b.Created_at DESC\n\t"; $postResult = mysqli_query($con, $selectPost) or die("Error gettings post data: " . mysqli_error($con) . "<br>{$selectPost}"); while ($row = mysqli_fetch_array($postResult)) { $post[] = $row; } function getJSONOutput($con, $postid) { $selectUser = "******"; $userResult = mysqli_query($con, $selectUser) or die("Error gettings user data: " . mysqli_error($con) . "<br>{$selectUser}"); $out['cols'] = array(array("id" => "a", "label" => "Date", "type" => "datetime"), array("id" => "b", "label" => "Comment Count", "type" => "number"), array("id" => "c", "label" => "Like Count", "type" => "number")); $x = 0; while ($row = mysqli_fetch_array($userResult)) { if (isset($row['Created_at'])) { $year = date("Y", strtotime($row['Created_at'])); $month = date("m", strtotime($row['Created_at'])) - 1; $day = date("d", strtotime($row['Created_at'])); $hour = date("H", strtotime($row['Created_at'])); $minutes = date("i", strtotime($row['Created_at'])); $seconds = date("s", strtotime($row['Created_at'])); $user = array(); $user[] = array("v" => "Date({$year}, {$month}, {$day}, {$hour}, {$minutes}, {$seconds})"); $user[] = array("v" => intval($row['CommentCount'])); $user[] = array("v" => floatval($row['LikeCount'])); $rows[$x] = array("c" => $user); $x++; } }