bonjour les amis,

svp pouvez vous m'aider avec cette fonction is_date_search

j'ai ce message , la source c'est bien cette fonction

DataTables warning: table id=order_data - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$connect = mysqli_connect("localhost", "root", "", "payment");
$query ="SELECT,payment1.*, `contrat`.`ID`, `contrat`.`Per_Fiscal`,SUM(payment1.PAYEMENT),SUM(payment1.INTEREST),SUM(payment1.PRINCIPAL),MIN(payment1.BALANCE)
FROM `contrat`
LEFT JOIN `payment1` ON `contrat`.`ID` = `payment1`.`ID`
WHERE ";
if($_POST["is_date_search"] == "yes")
{
 $query .= 'payment1.DATE BETWEEN "'.$_POST["start_date"].'" AND "'.$_POST["end_date"].'" ';
}
 
 
$result = mysqli_query($connect, $query);
 
$data = array();
while($row = mysqli_fetch_array($result))
{
 $sub_array = array();
 $sub_array[] = $row["ID"];
 $sub_array[] = $row["SUM(payment1.PAYEMENT)"];
 $sub_array[] = $row["SUM(payment1.INTEREST)"];
 $sub_array[] = $row["SUM(payment1.PRINCIPAL)"];
 $sub_array[] = $row["MIN(payment1.BALANCE)"];
 $sub_array[] = $row["payment1.DATE"];
 $data[] = $sub_array;        
}
$output = array(
    "data"    => $data
        );
echo json_encode($output);
 
?>