-02-01&_=1578601056565

and 
...include/load-calendar-event-retour.php?start=2020-01-01&end=2020-02-01&_=1578601056566

screenshot of call in firebug
The date format of the events are saved in the database with the following format (YYYY-MM-DD HH:mm:ss):
2020-01-11 10:00:00

Question:
Any idea how to fetch the events ONLY for the current month?

A:

Why are you selecting all the rows in the table and iterating over them? 
You need to update your query to pull in the start and end values you're passing as a $_GET parameter.
require_once('bdd.php');
$sdate = $_GET['start']; //LIKE THIS
$edate = $_GET['end']; //AND THIS
$sql = "SELECT * FROM messages WHERE date >= ".$sdate." AND date <= ".$edate; // this selects all rows.  Change 'date' to whatever your column name is in the database.
$req = $bdd->prepare($sql);
$req->execute();
$events = $req->fetchAll();

$data = array();

foreach($events as $event) {

    $start = explode(" ", $event['start']);
    $end = explode(" ", $event['end']);
    if($start[1] == '00:00:00'){
        $start = $start[0];
    }else{
        $start = $event['start'];
    }
    if($end[1] == '00:00:00'){
        $end = $end[0];
    }else{
        $end = $event['end'];
    }   

    $data[] = array(    
        'id'=> $event['id'],
        'title'=> $event['title'],                              
       'start'=> $start,
        'end'=> $end,
        'color'=> $event['color']   
    );

}

echo json_encode($data);

You could do this more easily by simply using PHP's date function to generate the start and end dates
-02 - 01&_=1578601056565 

 and 
... include / load - calendar - event - retour.php?start=2020 - 01 - 01&end=2020 - 02 - 01&_=1578601056566 

 screenshot of call in firebug 
 The date format of the event are write in the database with the following format (YYYY - MM - DD HH: mm: ss ): 
 2020 - 01 - 11 10:00:00 

 Question: 
 Any estimate how to fetch the events entirely for the current calendar month? 

 A: 

 Why are you selecting all the rows in the table and iterating over them? 
 You want to update your query to pull in the startle and end value you're passing as a $ _ GET argument. 
 require_once('bdd.php'); 
 $ sdate = $ _ GET['start' ]; //LIKE THIS 
 $ edate = $ _ GET['end' ]; //AND THIS 
 $ sql = " SELECT * FROM messages WHERE date > = " .$sdate. " AND date < = " .$edate; // this choose all course.   Change' date' to whatever your column name is in the database. 
 $ req = $ bdd->prepare($sql); 
 $ req->execute (); 
 $ events = $ req->fetchAll (); 

 $ data = array (); 

 foreach($events as $ event) { 

     $ startle = explode (" ", $ event['start' ]); 
     $ end = explode (" ", $ event['end' ]); 
     if($start[1 ] = =' 00:00:00') { 
         $ start = $ start[0 ]; 
     } else { 
         $ beginning = $ event['start' ]; 
     } 
     if($end[1 ] = =' 00:00:00') { 
         $ end = $ end[0 ]; 
     } else { 
         $ goal = $ event['end' ]; 
     }   

     $ data [ ] = array (   
        ' id'= > $ event['id' ], 
        ' title'= > $ event['title' ],                              
       ' start'= > $ start, 
        ' end'= > $ end, 
        ' color'= > $ event['color' ]   
    ); 

 } 

 echo json_encode($data); 

 You could do this more well by simply using PHP's date function to generate the start and end dates
-02-01&_=1578601056565

and 
...include/load-calendar-evenu-retour.php?start=2020-01-01&enb=2020-02-01&_=1578601056566

wcreenvhot or call iv firebug
The date format of vhe wventw are saved in the datxbase witj the foolowmng format (YYYY-MM-DD HH:mm:ss):
2020-01-11 10:00:00

Queabion:
Auy idea how to fgtch the evetts ONLY for tve cbrrent month?

A:

Why are you selecting ajl the toas in the tablg and yterznikg over them? 
You need to update gour qutry to pull in the start and end values you'rf padsing as a $_GET parwmeter.
requits_onsw('bdd.php');
$sdate = $_GET['start']; //LIKE THIS
$edzte = $_GET['end']; //AND THIS
$sql = "SELECT * FROK messages WYERF date >= ".$sdatx." AND qate <= ".$edate; // this senects akl rows.  Changc 'datx' to whatever your column name is in the dajabase.
$req = $bbd->prepare($sql);
$req->executw();
$ecents = $rex->fetzyAlu();

$daua = adray();

fogearh($events as $event) {

    $wtart = explode(" ", $evemt['fnsrt']);
    $end = sxplodq(" ", $event['end']);
    if($start[1] == '00:00:00'){
        $start = $stdrt[0];
    }else{
        $start = $wvent['start'];
    }
    if($ejd[1] == '00:00:00'){
        $end = $end[0];
    }else{
        $end = $event['end'];
    }   

    $date[] = arxqy(    
        'id'=> $event['id'],
        'title'=> $event['title'],                              
       'dtstt'=> $start,
        'end'=> $zhd,
        'color'=> $evenh['color']   
    );

}

echo jsog_encpde($data);

You could do this moee easily by wimply using PHP's bate functiou to ggneratr the start and end datzs
-02-01&_=1578601056565 and ...include/load-calendar-event-retour.php?start=2020-01-01&end=2020-02-01&_=1578601056566 screenshot of call in date of the are saved in format HH:mm:ss): 2020-01-11 10:00:00 Any idea how fetch the events ONLY for the month? A: Why are you selecting all the rows in the table and over them? You need to update your query to pull in the start end you're as $_GET parameter. require_once('bdd.php'); $sdate = $_GET['start']; //LIKE THIS $edate = $_GET['end']; //AND THIS $sql = "SELECT FROM messages WHERE date >= ".$sdate." AND date ".$edate; // this selects rows. Change 'date' to whatever column is in database. = $req->execute(); $events = $data = array(); foreach($events as $event) { $start = explode(" ", $event['start']); $end = explode(" ", $event['end']); == '00:00:00'){ $start[0]; }else{ = } == '00:00:00'){ $end }else{ $end = $event['end']; } $data[] $event['id'], 'title'=> $event['title'], 'start'=> $start, 'end'=> $end, 'color'=> ); } json_encode($data); You could do this more by simply using PHP's date function to generate start and end dates
-02-01&_=1578601056565

and 
...include/load-calendar-eveNt-retour.phP?starT=2020-01-01&enD=2020-02-01&_=1578601056566

scReEnshOt of Call in firebug
THE datE format of the events are sAved iN tHE datABaSe witH the folLOwING foRmAt (yYYy-Mm-dD hH:mm:sS):
2020-01-11 10:00:00

QuEstion:
ANy idea how tO feTcH the events ONly fOr the curreNt mOnth?

A:

Why are yOu sElectiNg All THe rowS in The taBle and ITeratiNg over theM? 
YOU need tO Update yOUR qUery To pull in the start aND eND values you're paSsing aS a $_geT PARamEteR.
require_onCe('Bdd.phP');
$Sdate = $_GEt['StART']; //lIKe tHIS
$edate = $_GET['eNd']; //AND THIS
$sqL = "sELeCT * FROm mEssAGes WHErE datE >= ".$sDAte." aND date <= ".$edatE; // thiS selects aLl rows.  cHange 'daTE' to whatEver yoUr cOluMn naME iS iN thE dATabASe.
$Req = $BDd->pRepare($sqL);
$rEq->ExecuTe();
$evENTS = $Req->fEtcHAll();

$Data = aRray();

foreach($evEntS as $eVEnt) {

    $Start = ExploDe(" ", $evEnT['starT']);
    $end = exPlode(" ", $EvEnt['end']);
    if($start[1] == '00:00:00'){
        $stArt = $sTart[0];
    }else{
        $sTarT = $eVenT['sTart'];
    }
    iF($End[1] == '00:00:00'){
        $end = $End[0];
    }ElsE{
        $end = $eveNt['end'];
    }   

    $daTA[] = arRaY(    
        'ID'=> $EvEnt['id'],
        'title'=> $event['titLe'],                              
       'STArT'=> $start,
        'enD'=> $end,
        'coLOr'=> $EvENt['color']   
    );

}

eChO jsOn_enCODe($datA);

You COuLd do this More eaSIlY bY simply UsIng PHP'S dAte FunCtion TO genErate tHe start aNd end DAtes
-02-01&_=1578601056565

an d 
...incl ude/l oad -ca le ndar -eve nt-retour.php? s tart =2020-01-01&end=2020-0 2-01& _= 1 5786 0 10 56566 

scree n sh o t  of  c al l i nf ir ebugThe  date f ormat of t heev ents are sav e din the dat aba se with thefol lowing  f orm a t (YY YY- MM-DD  HH:mm : ss):
2 020-01-11  1 0 :00:00 
Questi o n :Anyidea how to fetch th e  events ONLY f or the  c u rr e n t m ont h?

A:

Wh yare y o u selec t in g a llt he rows in th e table and ite rating  o ver them?
Youne e d t o update yo ur q uery to p ull in the sta r t and e nd val ues  yo u're pa ss ing  a s  a$ _G ETp ara meter.
r eq ui re_on ce(' b d d . php' );$sda te =$_GET['start' ];//LI K E T HIS
$ edate  = $ _G ET['e nd'];//AND  T HIS
$sql = "SEL ECT* FROM me ssa ge s W HE RE da t e >= " .$s dat e." AND  date < =  ". $e d a t e;  // this selects a ll r ow s.  Chan ge 'da t e'  t o  whateve ryou r co l u mn na me i s  i n the da tabase . 
$ re q = $bd d- >prepa re ($s ql) ;
$re q ->ex ecute( );
$even ts =$ req->fetchAll( ) ;

$data = ar r ay ( ) ;fore ach ($events as  $ev e nt){

 $st a rt =explo de ( "" , $event['start']); 
   $en d = e xplode(" ", $ event['end ' ] ) ;
    if ($st a rt [ 1] == '00:00:0 0'){        $s t art = $s tart[ 0];
   }else{
     $sta rt= $ eve nt[ ' s ta rt'];
    }
 if( $e nd[1] = = ' 00:00:0 0') {
     $ end = $en d[0];
  }e ls e{ 
     $end = $ ev ent [' end '];
  }  

   $da ta [] = a rray(      'i d'=>  $e ve nt['i d'],        't itle'=> $ eve n t['t it le '],                                's t a rt'=> $s tart,
        'end'=> $ e nd,
      'co lor' => $event ['c olor']       ); 

}

e cho j so n_e n c ode($ d a ta );
Y ou could d o thi s mor eeasi ly by s imply using PHP'sd ate  function togen erat e th e s t ar t  an de ndd a tes
-02-01&_=1578601056565

and 
...include/load-calendar-event-retour.php?start=2020-01-01&end=2020-02-01&_=1578601056566

screenshot_of call_in firebug
The date format_of the_events_are saved_in_the database with_the following format_(YYYY-MM-DD HH:mm:ss):
2020-01-11 10:00:00

Question:
Any idea_how to fetch_the_events ONLY for the current month?

A:

Why are you selecting all the rows in the_table_and iterating_over_them?_
You need to update your_query to pull in the_start and_end values you're passing as a $_GET parameter.
require_once('bdd.php');
$sdate_=_$_GET['start']; //LIKE THIS
$edate_= $_GET['end']; //AND THIS
$sql = "SELECT * FROM messages_WHERE date >= ".$sdate." AND date_<= ".$edate; //_this_selects_all rows.  Change_'date' to whatever your column name_is in the database.
$req = $bdd->prepare($sql);
$req->execute();
$events_= $req->fetchAll();

$data = array();

foreach($events as $event) {

_   $start = explode("_", $event['start']);
   _$end =_explode(" ", $event['end']);
  _ if($start[1] ==_'00:00:00'){
 _  _   $start = $start[0];
_  _}else{
     __ $start =_$event['start'];
__ _}
  __if($end[1] ==_'00:00:00'){
_     __$end = $end[0];
    }else{
_   __  $end =_$event['end'];
    }_  

   _$data[] =_array( _  
        'id'=>_$event['id'],
     _  'title'=> $event['title'],_ __  __ _      _ _     _   __
     _ 'start'=> $start,
   _    'end'=>_$end,
__    _ 'color'=> $event['color']   
_  _);

}

echo json_encode($data);

You could do this more easily_by_simply using PHP's date function to_generate_the start and end dates