Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by John McGrath on Nov 04, 2009 19:44
open dhtmlx forum
Problem with update after insert in Scheduler

I am uing the following code without issue in FireFox but it does not work in IE. The success($thisid) seems to work on the next insert so it appears to be one transaction behind at all times. (the screen updates the first event after adding the next)

###########################################################################
    public function insert($data,$source){
        //custom class
        $db = new DatabaseConnection();
        
        $sql=$this->insert_query($data,$source);
        $this->query($sql);
        $thisid=$this->get_new_id();
        $custid=$data->get_value("customerid");
        
        //find the customer from the event_rec table
        $studsql="select firstname, lastname from customer where customerid=".$custid;
        $res = $db->getRecord($studsql);
        $fullname = $res['firstname'] . " " . $res['lastname'];
        
        //set the text to the customer name
        $update_sql ="UPDATE events_rec SET text='".$fullname."' WHERE event_id='".$thisid ."'";
        $db->do_sql($update_sql);
        
        $data->success($thisid);
        
    }

#############################################################################

Thanks in advance for any assistance.
Answer posted by Alex (support) on Nov 05, 2009 01:36
Do you use connectors ?

The provided function calls methods from some other classes.

But if you use connectors, try to enable logs to get more information about the issue:

$scheduler = new schedulerConnector(....);
$scheduler->enable_log("log.txt",true);

Please, provide more details to solve the issue.


Answer posted by John McGrath on Nov 05, 2009 06:30

I do use connectors but also a custom class.

I have has logging turned on but see no errors. Once again, it works perfectly in Firefox just not IE.

Below is a copy of a log entry...

 

====================================
Log started, 05/11/2009 06:11:06
====================================

SELECT event_id,start_date,end_date,text,customerid,serviceid,rec_type FROM events_rec

Done in 0.0020232200622559s

 

====================================
Log started, 05/11/2009 06:11:13
====================================

SELECT event_id,start_date,end_date,text,customerid,serviceid,rec_type FROM events_rec

Done in 0.0024349689483643s

 

====================================
Log started, 05/11/2009 06:11:13
====================================

DataProcessor object initialized
1257431305657_start_date => 2009-11-3 08:15
1257431305657_end_date => 2009-11-3 08:30
1257431305657_text => New Appointment
1257431305657_id => 1257431305657
1257431305657_rec_pattern =>
1257431305657_rec_type =>
1257431305657_customerid => 90
1257431305657_serviceid => 496
1257431305657_!nativeeditor_status => inserted
ids => 1257431305657

Row data [1257431305657]
start_date => 2009-11-3 08:15
end_date => 2009-11-3 08:30
text => New Appointment
id => 1257431305657
rec_pattern =>
rec_type =>
customerid => 90
serviceid => 496
!nativeeditor_status => inserted

INSERT INTO events_rec(start_date,end_date,text,customerid,serviceid,rec_type) VALUES ('2009-11-3 08:15','2009-11-3 08:30','New Appointment','90','496','')

Edit operation finished
0 => Object id #8

Done in 0.0039138793945312s

 

Answer posted by Alex (support) on Nov 05, 2009 06:53

So... if you use a custom solution, how can we solve the issue ?

Try to check that you code returns the correct xml as the response.