1) return $xxx[1]; else return -1; } // connect to the hanoi database $servername = "localhost"; $username = "gtstudent"; $password = ""; $dbname = "hanoi"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $aaa = Array(); $sql = "select * from timedata"; $result = $conn->query($sql); // read all the results, just to determine the bounds of the graph while (null != ($row = $result->fetch_assoc())) { $secs = toSecs($row["time"]); if ($secs > 0) { array_push($aaa, $secs); } } echo json_encode($aaa); ?>