good morning,
let’s start with weird values submitted to my database.
This is, what I try to insert:
$data = [
'user_id' => 'abcdef',
'geaendert_von' => 'abcdef',
'datum' => '2021-03-21',
'anfang' => '10:12',
'ende' => '14:55',
'feiertag' => 0 ,
'schlusssschicht' => 0,
'pause' => 0,
'dauer' => 275,
'anmerkungen' => 'nix'
];
$id = Db::insert('arbeitszeiterfassung', $data);
10 Columns, 10 values.
$id returns 0, something went wrong
So I do this:
echo '<pre>';
echo Database::instance()->lastQuery();
echo '</pre>';
to look at the query submitted, which is resulting in:
INSERT INTO
`arbeitszeiterfassung`
(`arbeitszeiterfassung`.`user_id`,
`arbeitszeiterfassung`.`geaendert_von`,
`arbeitszeiterfassung`.`datum`,
`arbeitszeiterfassung`.`anfang`,
`arbeitszeiterfassung`.`ende`,
`arbeitszeiterfassung`.`feiertag`, ,
`arbeitszeiterfassung`.`pause`,
`arbeitszeiterfassung`.`dauer`, )
VALUES (
:value_RhZP1jXB,
:value_ULO5sVyJ,
:value_YlmiecJ1,
:value_RUSTtqGz,
:value_2oGBibHx,
:value_UchTCFgV,
:value_6tDhK8rd,
:value_dy4Tr4OT,
:value_h1OQPfX3,
:value_QXQak6Z3)
What puzzles me first are the weird values. Where do they come from?
But second: I submitted 10 columns and 10 values, but submitted are 8 columns and 10 values.
Look at arbeitszeiterfassung
.feiertag
, ,
A double comma? Where did the column between them go? And why did the last column
anmerkungen disappear?
And another question at last: how are the objects Database, $database, DB:: related. Can I use them all at the same time?