Can only write back to database once per object.

Im using scheduler and data processor to write back to my database.

When I have appointments in my calendar, If I drag one to a different time, it reloads the schedueler and updates the new time. If i try to drag the same one again without refreshing the page, it always goes back to its old time. I can drag all different appointments in one go but cant do the same appointment twice.

This has baffled me for months and I am stuck :frowning:

Anyone any ideas?

[code]<?php error_reporting(0); ini_set('display_errors', 0); ob_start(); session_start(); include_once("../../config/config.php");include_once("../../include/function.php"); include_once("../../include/insert_update_function.php"); ?>

<?php $salon_arr= get_the_salon($_SESSION['salon_slno']); ?> <?php echo $salon_arr['salon'] ?>
<link href="salon/style.css" type="text/css" rel="stylesheet" />
<link href="salon/style1.css" type="text/css" rel="stylesheet" />

Select Services:

    <div>
        <ul class="booking1-services-list" style="display: block;">
                
            <?php
            $wx_arr=json_decode(get_salon_meta($_SESSION['salon_slno'], "group_order"));


            foreach ($wx_arr as $key => $value) {
            foreach ($value as $v) {
            $group_arr=get_the_group($v);    
            ?>
                <li class="header"><?=$group_arr['title']?></li>
                <?php
                 $ress=mysql_query("SELECT * FROM `salon_service` WHERE `group`='$group_arr[slno]' AND `status`='active'");
                 if(mysql_num_rows($ress)){ 
                 ?>
                <?php
                $wx_arr1=json_decode($group_arr['serviece_order']);
                foreach ($wx_arr1 as $key1 => $value1) {
                foreach ($value1 as $v1) {

                $dataxx=get_the_service($v1);
                             $pdata=json_decode($dataxx['price'] );    
                ?>
                
                    <li class="<?php if($dataxx['price_type']=='normal'){ ?> highlighted clicky_log <?php } ?> clearfix" data-price="<?=$pdata[0][1] ?>" data-duration="<?=$dataxx['duration'] ?>">
                        <div class="text">
                            <?=$dataxx['name'] ?>
                            <div>
                                <div class="service-text"><?=$dataxx['additional_info'] ?></div>
                            </div>
                        </div>
                        <div class="price">
                            <?php 


                            if($dataxx['price_type']=='normal'){ echo "£".$pdata[0][1]; }

                            ?>
                        </div>
                    </li>
                    
                    <?php if($dataxx['price_type']=='custom'){  for($i=0;$i<count($pdata);$i++){ ?>
                    <li class="highlighted clicky_log clearfix" data-price="<?=$pdata[$i][1] ?>" data-duration="<?=$dataxx['duration'] ?>" style="height: 22px;width: 450px;margin-left: 160px;">
                        <div class="text" style="display: none;">
                            <?=$dataxx['name'] ?>:<?=$pdata[$i][0] ?>
                            <div>
                               
                            </div>
                        </div>
                        <div class="text12"><?=$pdata[$i][0] ?></div>
                        <div class="price">£<?=$pdata[$i][1] ?></div>
                    </li>
                    <?php }} ?>
                    
                    
                    <?php }} ?>
                    <?php } else { ?>
                            <h4 class="text-error">No Service found under this category.</h4>
                                 <?php } ?>
                <?php  }} ?>     


            <li style="display: none"></li>
        </ul>
    </div>

    <div class="xfooter cal-services-list-footer">
        <button id="cal-services-ok-button" type="button" class="button5">OK</button>
        <button id="cal-services-cancel-button" type="button" class="button5">Cancel</button>
    </div>
</div>
 
 
 
<?php $staffs=""; $res=mysql_query("SELECT * FROM `".STAFF."` WHERE `salon`='$_SESSION[salon_slno]' AND `status`='active' ORDER BY `slno` ASC"); while($ldat=mysql_fetch_array($res)){
$staffs=$staffs.'{ "key":"'.staff_gid($ldat['slno']).'", "label":"'.$ldat['name'].'"},'; 

}
?>

</div>

<div id="calendar-bottom" class="clearfix">
    <a href="javascript:void()" class="button6 slim" onclick="location.reload()" >Refresh</a>
    <!--<a href="javascript:void()" class="button6 slim" onclick="reloadData()" >Reload</a>-->
    <a href="../download-appoinment.php" class="button6 slim"  >Download</a>
    <div class="blocked">Non working Hours / Breaks</div>
    <div class="online-booking">Online Booking</div>
    <div class="appointment">Regular</div>
    <div class="recurring">Repeating Events</div>
</div>
<?php $pixel=1.4; $result=mysql_query("SELECT * FROM `".APPOINMENT."` WHERE `status`='active'"); while($data= mysql_fetch_array($result)){ $serv_arr= array_filter(array_unique(explode(",",$data['service']))); $backgrounds=array(); $background_position=array(); $background_image=array(); $duration=0; foreach ($serv_arr as $sa){ $sa=explode(":",$sa); $s_arr=get_the_service($sa[0]); if($s_arr['padding_before']!="0"){ $start=$duration+intval($s_arr['padding_before']); $start=floatval($start)*floatval($pixel)-14; $s_arr['duration']; $depth=intval($s_arr['duration'])-intval($s_arr['padding_before'])-intval($s_arr['padding_after']); $depth=floatval($depth)*floatval($pixel); array_push($backgrounds," 100% ".$depth."px"); array_push($background_position,$start."px"); array_push($background_image, 'url("grayimg.jpg")'); } $duration=$duration+intval($s_arr['duration']); } $backgrounds=implode(",", $backgrounds); $background_position=implode(",", $background_position); $background_image=implode(",", $background_image); if($data['type']=="online")$color="#9FC6E7"; if($data['type']=="regular")$color="#FBED9B"; ?> div[event_id="<?=$data['apid']?>"] .dhx_body{ background-color: <?=$color?> !important; background-size: <?=$backgrounds?> !important; background-image: <?=$background_image?> !important; background-repeat: no-repeat !important; background-position-y: <?=$background_position?> !important; } <?php } ?>
        [/code]

Hello,
check the response of the dataprocessor. Maybe it returns invalid XML and client-side event stays in incorrect state after editing, untill data is reloaded.

I can’t tell much more from the code, can you give a link to the page where it can be tested?