I am trying to query a table on my database and assign arrays to individual sets of results,
then i will use these results in a FLOT graph to plot them....
i am connected to the database and attempting to pull data,
i then use the following query:
<?php
// Main query to pull data from 'tests' table
$sql = "SELECT * FROM `tests` WHERE member_id = '1'";
$result = mysql_query($sql) or die ("no query");
// Dataset1
if ($result)
{
while ($row=$result1->fetch_assoc())
{
$dataset1[] = array($row['test1'],$row['date']);
}
}
?>
i then try to plot the first graph using the following javascript
<script type="text/javascript">
//put array into javascript variable
var dataset1 = <?php echo json_encode($dataset1); ?>;
//plot
$(function () {
$.plot($("#placeholder"), [ dataset1 ]);
});
but i'm getting the error
atal error: Call to a member function fetch_assoc() on a non-object in /homepages/test.php on line 25
once this works i will then continue the charts from 'test1' all the way to 'test9'
all with individual charts..
where am i going wrong guys???
Thanks