I’m not sure what I’m doing wrong, but I have a feeling it’s my JSON code… Here is a jsfiddle using my JSON and here is the code behind my JSON
<?php $username = ""; $password = ""; $dbname = ""; // Create connection $conn = new mysqli('localhost',$username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT date FROM db"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row $obj = array(); while($row = $result->fetch_assoc()) { $element = array($row["ban_date"]); array_push($obj,$element); } echo json_encode($obj); } else { echo "0 results"; } $conn->close(); ?>
Ah ok. So my JSON should still work much like yours or do I need to change to be an array of objects (if so how would I do that? I’m not that familiar with JSON files in case you can’t tell) Thanks so much for Helping Priyanka :)
Thanks that’s perfect, quick of topic question how did you code your JSON? Your’s looks much better then mine :) http://banlister.com/graph-test/service.php
Yea that’s awesome, quick question? I’m using a JSON file to get the dates, how can I incorporate that into that example?