the following code is not working as expected, the echo statement never return any response to the client side and it is hang.
$query = "INSERT INTO Tasks (ProjectID,Title,Start,End,PercentComplete,ParentID,OrderID,Summary,Expanded,LastUpdate)
VALUES($project_Id, '$title','$start','$end','$percentComplete',$parentID,'$orderID','$summary','$expanded',NOW())";
$result = mysqli_query($con, $query);
if ($result) {
$last_id = mysqli_insert_id($con);
echo json_encode(array(ID => $last_id, Title => $title, Start => $start, End => $end, percentComplete => $percentComplete));
}
However, if I added one more line of echo as follows, both the echo statement is able to be received on the client side.
$query = "INSERT INTO Tasks (ProjectID,Title,Start,End,PercentComplete,ParentID,OrderID,Summary,Expanded,LastUpdate)
VALUES($project_Id, '$title','$start','$end','$percentComplete',$parentID,'$orderID','$summary','$expanded',NOW())";
$result = mysqli_query($con, $query);
if ($result) {
$last_id = mysqli_insert_id($con);
echo json_encode(array(ID => $last_id, Title => $title, Start => $start, End => $end, percentComplete => $percentComplete));
echo 1;
}
I cannot figure out what is wrong here, please help to advice on this. Thanks