i extract years from mysql using the array loop like this,
foreach (array(date('Y', strtotime($row['drilling_date']))) as $v) {
//1988, 1989, 1990 and so on..
$current_year = $v;
$next_year = $v+1; // which shows the year nest to $current_year
// problem here
}
Is there any way i could loop the select to query between years with one query
i have this right now but its not working..
foreach (array("SELECT COUNT(result) FROM hptw WHERE drilling_date between '$v-04-01' AND '$next-03-01' and result = 'success'") as $b);
What i am trying to do is that put the COUNT result in array, the first array would contain the result of 1988 and 1989, the second array, 1989-1990 ... and the third array 1990-1991 an continue looping till it fetch all the year present in the database..
e.g (45(between 1988 - 1989), 50(between 1989-1990) and so on.......)
I hope there is another approach to solve this..
oh i also get this result
Resource id #6
foreach (array(date('Y', strtotime($row['drilling_date']))) as $v) {
//1988, 1989, 1990 and so on..
$current_year = $v;
$next_year = $v+1; // which shows the year nest to $current_year
// problem here
}
Is there any way i could loop the select to query between years with one query
i have this right now but its not working..
foreach (array("SELECT COUNT(result) FROM hptw WHERE drilling_date between '$v-04-01' AND '$next-03-01' and result = 'success'") as $b);
What i am trying to do is that put the COUNT result in array, the first array would contain the result of 1988 and 1989, the second array, 1989-1990 ... and the third array 1990-1991 an continue looping till it fetch all the year present in the database..
e.g (45(between 1988 - 1989), 50(between 1989-1990) and so on.......)
I hope there is another approach to solve this..
oh i also get this result
Resource id #6
Last edited: