-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.php
More file actions
64 lines (35 loc) · 1.35 KB
/
data.php
File metadata and controls
64 lines (35 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
$connection = mysql_connect("localhost:8888", "infovis2", "infovis2");
mysql_select_db("infovis2", $connection);
if(!$connection){
echo "Connection to the database failed.";
} else {
}
if(isset($_POST["month"])){
$month = $_POST["month"];
//echo $month;
} else {
$month = 1;
}
if(isset($_POST["year"])){
$year = $_POST["year"];
//echo $month;
} else {
$year = 2009;
}
//$sqlString = "SELECT username, COUNT(*) as convoCount FROM conversations WHERE year = 2008 AND username != 'Me' GROUP BY username";
//echo $sqlString;
//$query = mysql_query($sqlString) or die(mysql_errno($connection);
//working other
//$query = mysql_query("SELECT username, COUNT(*) as convoCount FROM conversations WHERE year = 2008 AND month = ". $month . " AND username != 'Me' GROUP BY username") or die(mysql_errno($connection));
//************ Start Working ************
// Database Queries
$query = mysql_query("SELECT username, COUNT(*) as convoCount FROM conversations WHERE year = ". $year ." AND month = ". $month . "" . $weekdayQuery . " AND username != 'Me' AND username != 'aolsystemmsg' GROUP BY username") or die(mysql_errno($connection));
//************ End Working ************
$rows = array();
while($row = mysql_fetch_assoc($query)) {
$rows[] = $row;
}
//echo json_encode($rows);
echo json_encode($rows);
?>