I have read these questions:
and some google suggested links. No clue.
Here is my situation. I have a table, inkubator_pinjam, in MariaDB 10.0 defined as
CREATE TABLE `inkubator_pinjam` (
`id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
`kode_pinjam` VARCHAR(20) NOT NULL DEFAULT '',
`id_inkubator` BIGINT(20) NOT NULL DEFAULT '0',
`tgl_pinjam` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`nama_bayi` VARCHAR(75) NOT NULL DEFAULT '',
`kembar` ENUM('Y','N') NOT NULL DEFAULT 'N',
`tgl_lahir` DATE NULL DEFAULT NULL,
`berat_lahir` DECIMAL(10,2) NOT NULL DEFAULT '0.00',
`panjang_lahir` DECIMAL(10,2) NOT NULL DEFAULT '0.00',
`kondisi` ENUM('SEHAT','SAKIT') NOT NULL DEFAULT 'SEHAT',
`rumah_sakit` VARCHAR(50) NOT NULL DEFAULT '',
`nama_dokter` VARCHAR(75) NOT NULL DEFAULT '',
`tgl_pulang` DATE NULL DEFAULT NULL,
`no_kk` VARCHAR(50) NOT NULL DEFAULT '',
`alamat` TEXT NULL,
`nama_ibu` VARCHAR(50) NOT NULL DEFAULT '',
`hp_ibu` VARCHAR(20) NOT NULL DEFAULT '',
`email_ibu` VARCHAR(50) NOT NULL DEFAULT '',
`nama_ayah` VARCHAR(50) NOT NULL DEFAULT '',
`hp_ayah` VARCHAR(20) NOT NULL DEFAULT '',
`email_ayah` VARCHAR(50) NOT NULL DEFAULT '',
`jumlah_pinjam` INT(2) NOT NULL DEFAULT '1',
`status_pinjam` ENUM('Ditunda','Disetujui','Ditolak') NOT NULL DEFAULT 'Ditunda',
`tgl_update_status_pinjam` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`keterangan_status_pinjam` VARCHAR(200) NOT NULL DEFAULT '',
`konfirmasi` ENUM('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=MyISAM
AUTO_INCREMENT=2
;
with a trigger on AFTER DELETE event doing this
CREATE DEFINER=`inkubator`@`localhost` TRIGGER `inkubator_pinjam_after_delete` AFTER DELETE ON `inkubator_pinjam` FOR EACH ROW BEGIN
delete from inkubator_monitoring where kode_pinjam = OLD.kode_pinjam;
delete from inkubator_kembali where kode_pinjam = OLD.kode_pinjam;
END
In PHP, my PHP script generates an insert SQL to add data to the table:
insert into inkubator_pinjam (
id, kode_pinjam, id_inkubator, tgl_pinjam,
nama_bayi, kembar, tgl_lahir, berat_lahir,
panjang_lahir, kondisi, rumah_sakit,
nama_dokter, tgl_pulang, no_kk, alamat,
nama_ibu, hp_ibu, email_ibu, nama_ayah,
hp_ayah, email_ayah, jumlah_pinjam,
keterangan_status_pinjam, konfirmasi
) values (
24145550156759089, '323431-343535-39', 0, CURRENT_TIMESTAMP(),
'DIAN KHAMSAWARNI', 'N', '2015-09-21', 3.2,
28, 'SEHAT', 'RSU Wahidin',
'Dr. Marhamah, Sp.OG', '2015-09-23', '9288299288', 'BTN Hamzy E8/A',
'RINA MAWARNI', '+62837739938845', '', 'ARIFIN ADINEGORO', '+62837739938845', '', 1,
'Ditunda untuk review.', 'Y'
);
What being problem here is MariaDB keeps showing error
SQL Error (1054): Unknown column curent_timestamp
in field list
which seems odd to me. But data insertion works, though, the data exists in the table. This is a big problem to me since data insertion works but MySQL reports back to PHP that an error has occurred, and my PHP script will fail...
Screenshot above was taken from HeidiSQL running the insertion SQL script, so the problem didn't come up from PHP.
The question is, how i remove this error?
I have double checked for mistyped current_timestamp
(double 'r') as curent_timestamp
(single 'r'), checked and rechecked for backticks, unclosed single and double quotes, trigger, and column defaults. Still have no clue.
Google has no hints, so any thought here will be highly appreciated. Thank you.
2 third-from-last lines
Add the two lines below as a test, removing remark characters:
insert into inkubator_pinjam (
id, kode_pinjam, id_inkubator, tgl_pinjam,
nama_bayi, kembar, tgl_lahir, berat_lahir,
panjang_lahir, kondisi, rumah_sakit,
nama_dokter, tgl_pulang, no_kk, alamat,
nama_ibu, hp_ibu, email_ibu, nama_ayah,
hp_ayah, email_ayah, jumlah_pinjam,
tgl_update_status_pinjam, -- <------ ADD THIS HERE ***********
keterangan_status_pinjam, konfirmasi
) values (
24145550156759089, '323431-343535-39', 0, CURRENT_TIMESTAMP(),
'DIAN KHAMSAWARNI', 'N', '2015-09-21', 3.2,
28, 'SEHAT', 'RSU Wahidin',
'Dr. Marhamah, Sp.OG', '2015-09-23', '9288299288', 'BTN Hamzy E8/A',
'RINA MAWARNI', '+62837739938845', '', 'ARIFIN ADINEGORO', '+62837739938845', '', 1,
CURRENT_TIMESTAMP(), -- <------ ADD THIS HERE ***********
'Ditunda untuk review.', 'Y'
);