Till now I am stuck with these code here the code for ajax I know This is wrong ..or something is not right ..
<script>
$(document).ready(function() {
$.ajaxSetup({ cache: false });
setInterval(function() {
$('#divToRefresh').load('userCount.php', function(data) {
$.each($(data), function(key, value) {
alert(value);
});
});
}, 3000);
});
</script>
here the userCount.php
$get_temp = "SELECT * FROM temperature_setting WHERE device_key = 'YMR200'";
$result = $conn->query($get_temp);
while($row = $result->fetch_assoc()) {
$temp_id[] = $row['temp_id'];
}
foreach ($temp_id as $id_value) {
$get_current_value = "SELECT $id_value FROM data_current WHERE device_key = 'YMR200'";
$result_value = $conn->query($get_current_value);
$row_value = $result_value->fetch_assoc();
$value[] = $row_value[$id_value];
}
print_r($value);
there are 15 value so each value should go to each
foreach ($temp_id as $id_value) { ?>
<p id="divToRefresh"></p>
<br>
<?php } ?>
according currently the out put of userCount is
Array ( [0] => 65 [1] => -8 [2] => -5 [3] => -3 [4] => -5 [5] => 25 [6] => -5 [7] => -5 [8] => -5 [9] => -5 [10] => -5 [11] => -5 [12] => -5 [13] => 25 [14] => -5 )
what I want is to put these value in each
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
<p id="divToRefresh"></p>
<br>
idattribute throughout the DOM. That's invalid as they must be unique. Use aclassinstead