Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Framework » problem with updateRecord()
problem with updateRecord() [message #4386] Fri, 25 July 2014 12:21 Go to previous message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
I have the following code in the _cm_post_insertRecord() function. I want to change values in a parent table after inserting an additional occurence in the child table.
But the values aren't updated with $dbobject->updateRecord ($data);

function _cm_post_insertRecord ($rowdata)
// perform custom processing before database record is inserted.
// if anything is placed in $this->errors the insert will be terminated.
{
// verfügbare (+1), belegte (+1) und freie Plätze (-1) werden aktualisiert
// get contents of foreign table SPIELE_TRANSPORT
$dbobject =& RDCsingleton::getInstance('spiele_transport'); // Instanz für Lookup-Tabelle
$where = "verbaende_art_id='{$rowdata['verbaende_art_id']}' AND
verbaende_kuerzel='{$rowdata['verbaende_kuerzel']}' AND
vereine_kuerzel='{$rowdata['vereine_kuerzel']}' AND
saison_id='{$rowdata['saison_id']}' AND
mannschaften_id='{$rowdata['mannschaften_id']}' AND
spiel_seq_no='{$rowdata['spiel_seq_no']}' AND
transport_no='{$rowdata['transport_no']}'";

$data = $dbobject->getData ($where);

if (!empty($data)){
$data = $data[0];
$data['transport_plaetze_belegt'] += 1;
$data['transport_plaetze_frei'] -= 1;
$dbobject->updateRecord ($data);

} // if

return $rowdata;

} // _cm_post_insertRecord

I know that in the std.tbl.class.inc the function updateRecord() comes with $fieldarray. But I don't know how to handle it.

What is wrong with my code?
Many Thanks in advance.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PROBLEM WITH DECIMAL POINT
Next Topic: pdf.styles.inc
Goto Forum:
  


Current Time: Thu Apr 25 04:58:47 EDT 2024

Total time taken to generate the page: 0.01012 seconds