0
votes

Sorry I have the following dilemma and I can't get out of it. In my Db I have the start & end dates for the events as you can see from the 'success load db' shows them both, but already on eventRender it has lost the end date. On event I have no particular configurations. Where did 'end' go? See Image 1 if end is different from start then it brings it back to me well. See Image 2

another question why if the event goes from 07/03/2021 7:30 to 08/03/2021 15:56 on the weekly calendar, daily etc will select me only one box of a single day?

events: {
      url:"../php/fetch-event.php",  
      method: 'POST',             
      failure: function() {
          alert('Nessun Evento Trovato.');
      },
      success: function(content, xhr) {              
        console.log('Success Load data db=',content)                
      },        [enter image description here][1]                                  
    },

enter image description here

enter image description here

1

1 Answers

1
votes

I found the problem is in the PHP file how I create the Json even if I still do not explain why I post it because it can be useful to someone, but this is how it works.

My file PHP

>     <?php
>         include "db_connect.php";
>         $connect = OpenCon();
>         $json = [];
>         $sqlQuery = "SELECT 
>                     calendar.id,                
>                     tb_odl.Odl_Desc as title,               
>                     calendar.start,                
>                     calendar.end,
>                     calendar.groupid,                
>                     calendar.id_user as resourceId,
>                     calendar.Notes as odlnote,
>                     tb_odl.odl_num as odlnum,
>                     tb_odl.id as odlid,
>                     tb_odl.color FROM calendar 
>                     LEFT JOIN tb_odl ON calendar.id_odl = tb_odl.id
>                     ORDER BY calendar.id";
// WORK:
> 
> $result = mysqli_query($connect, $sqlQuery); $eventArray = array();
> while ($row = mysqli_fetch_assoc($result)) {
>     array_push($eventArray, $row); } mysqli_free_result($result);
> 
> mysqli_close($connect); echo json_encode($eventArray); 

//NOT WORK
    $result = mysqli_query($connect, $sqlQuery);
    //$odlArray = array();
    $json = [];
    while ($row = mysqli_fetch_assoc($result)) {
        //array_push($odlArray, $row);
        $json[] = [
            'id'=>$row['id'],
            'title'=>$row['title'],
            'odldesc'=>$row['title'], 
            'start'=>$row['start'],
            'end'=>$row['end'],
            'color'=>$row['color'],
            'odlnum'=>$row['odlnum'],
            'resourceId'=>$row['resourceId'],
            'odlnote'=>$row['odlnote'],
            'groupId'=>$row['groupid'],
            'odlid'=>$row['odlid'],
            'allDay'=>'false'];    
    }  
    mysqli_free_result($result);
    mysqli_close($connect);
    echo json_encode($json);