i have this code and works fine to get the stats of january:
$home = 5;
$get_jan = $db->prepare('SELECT * FROM cars WHERE home = :home AND month = :month');
$get_jan->bindParam(':home',$home);
$get_jan->bindParam(':month',$janu);
$get_jan->execute();
i want to make some statistics so i need to do that for 12 months. Instead of writing this code for the 12 months separately how can i use a for loop? i tried something like this with no success:
$home = 5;
for($i=1;$i=12;$i++){
$get.$i = $db->prepare('SELECT * FROM cars WHERE home = :home AND month = :month');
$get.$i->bindParam(':home',$home);
$get.$i->bindParam(':month',$i);
$get.$i->execute();
}
Any idea how can be done?