Hi,
I am sure that the solution is easy but it's flummoxed me! I have a python script that sometimes doesn't record the temperature so I end up with 23 readings instead of 24 per day, or less.
My php script reads the date from the db and puts it into a array to use in a graph. My problem is that I need to check the correct temperature reading go with the correct hour of the day.
Array
(
[0] => Array
(
[0] => 00
[1] => 4.30
)
[1] => Array
(
[0] => 01
[1] => 4.30
)
[2] => Array
(
[0] => 02
[1] => 4.10
)
[3] => Array
(
[0] => 03
[1] => 4.00
)
[4] => Array
(
[0] => 05
[1] => 3.70
)
etc etc..
Above [0][0] is the time and [0][1] is the temperature, what I need is for the time to match the array key. So in [4][0] the time is 05 but the key is 04 i.e...
Array
(
[0] => Array
(
[0] => 00
[1] => 4.30
)
[1] => Array
(
[0] => 01
[1] => 4.30
)
[2] => Array
(
[0] => 02
[1] => 4.10
)
[3] => Array
(
[0] => 03
[1] => 4.00
)
[4] => Array
(
[0] => 04
[1] =>
)
[5] => Array
(
[0] => 05
[1] => 3.70
)
This is the code I use to make the array
while($row = $result->fetch_array())
{
$inside[] = $row;
$date = strtotime($inside[$i][Time]);
$inside[$i][4] = date('G', $date);
$inside[$i][2] = $inside[$i][0];
unset($inside[$i][Temp]);
unset($inside[$i][Time]);
unset($inside[$i][1]);
unset($inside[$i][0]);
++$i;
}
I can get it to check the time against the key, but I can not get it to correct the key to the time.
Can anyone help??
Many thanks James