[eluser]kingmaoam[/eluser]
Hey folks,
this time I have a very strange error...
I have a model where I insert and update database entries for a specific module.
Since yesterday everything worked ok.
I seem to have changed something what caused CI to update my database in an incorrect way.
The problem is with german umlauts (ä, ö, ü).
I have a field with the Text "Auslösung der Brandmeldeanlage". This entry was inserted into the database yesterday with the script which is not working today...
In my model I have following code
Code:
public function update_einsatz($id)
{
$einsatz = array(
'einsatzName' => $this->input->post('einsatzname'),
'datum' => cp_get_eng_date($this->input->post('einsatzdatum')),
'beginn' => $this->input->post('einsatzbeginn'),
'ende' => $this->input->post('einsatzende')
);
$einsatzContent = array(
'einsatzlage' => $this->input->post('einsatzlage'),
'einsatzgeschehen' => $this->input->post('einsatzgeschehen'),
'einsatzkraefteFreitext' => $this->input->post('weitereeinsatzkraefte'),
'anzahlEinsatzkraefte' => $this->input->post('anzahl')
);
// ++++ TRANSAKTION START ++++ //
$this->db->trans_start();
$this->db->where('einsatzID', $id);
$this->db->update('einsatz', $einsatz);
$this->db->where('einsatzID', $id);
$this->db->update('einsatz_content', $einsatzContent);
$this->db->where('einsatzID', $id);
$this->db->delete('einsatz_type_mapping', array('einsatzID' => $id));
$this->db->where('einsatzID', $id);
$this->db->delete('einsatz_fahrzeug_mapping', array('einsatzID' => $id));
array_walk($this->input->post(), array($this, 'callback_einsatz_find_mappings'));
foreach($this->arr_types_db as $t)
{
$this->db->insert('einsatz_type_mapping', array('einsatzID' => $id, 'typeID' => $t));
}
foreach($this->arr_fahrzeuge_db as $f)
{
$this->db->insert('einsatz_fahrzeug_mapping', array('einsatzID' => $id, 'fahrzeugID' => $f));
}
$this->recalc_lfdnr(substr($einsatz['datum'],0,4));
$this->db->trans_complete();
// ++++ TRANSAKTION ENDE ++++ //
}
When I var_dump the $einsatz array the field einsatzName contains the correct value.
Also using the CI profiler gives the correct values for POST
Code:
POST-DATEN
$_POST['einsatz_submit']
$_POST['einsatzname'] Auslösung der Brandmeldeanlage 2
$_POST['einsatzdatum'] 26.08.2012
$_POST['einsatzbeginn'] 00:00:00
$_POST['einsatzende'] 03:00:00
$_POST['anzahl'] 2
$_POST['einsatzlage'] <p>adsf</p>
$_POST['einsatzgeschehen'] <p>asdf</p>
$_POST['weitereinsatzkraefte'] <p>0</p>
$_POST['t_1'] 1
$_POST['f_1'] 1
When I echo the SQL query via $this->db->last_query(); right after the $this->db->insert('einsatz' ...) statement it echoes following query:
Code:
UPDATE `fw_einsatz` SET `einsatzName` = 'Auslösung der Brandmeldeanlage 2', `datum` = '2012-08-26', `beginn` = '00:00:00', `ende` = '03:00:00' WHERE `einsatzID` = '2067'
On executing the query in phpmyadmin the row is updated correctly. But my CI script results in the field einsatzName having the value "Ausl"
How can this happen? And why can this happen from yesterday to today without having changed something in above printed method...
My mySQL Settings are
tabletype InnoDB
Collation utf8_general_ci
Codepage utf8_unicode_ci
KR
Habib