hi , I’am newbie SC
I have a problem with SC.
on this form, i need get data from another table (kendaraan) and put this data to transaction table.
on transaction validate :
$nopol = sc_sql_injection({nomor_kendaraan});
$sql = “SELECT
depo,
divisi,
jenis,
merk,
tahun
FROM dbo.kendaraan
WHERE no_pol_baru =”.$nopol;
sc_lookup(rs, $sql);
if(count({rs}) == 0)
{
//sc_log_add(‘login Fail’, {lang_login_fail} . {login});
sc_error_message({lang_error_login});
sc_error_exit();
}
else
{
$bbm_depo = {depo};
$bbm_divisi = {divisi};
$bbm_jenis = {jenis};
$bbm_merk = {merk};
$bbm_tahun = {tahun};
}
//================================================
// WRITE TO DATABASE
//================================================
{week_bbm} = date(“W”,strtotime({tanggal}));
{month_bbm} = date(“m”,strtotime({tanggal}));
{year_bbm} = date(“Y”,strtotime({tanggal}));
{depo}=$bbm_depo;
{divisi}=$bbm_divisi;
{jenis_mobil} = $bbm_jenis;
{merk}=$bbm_merk;
{tahun_kendaraaan}= $bbm_tahun;
{rasio_bbm} = {jml_km} / {liter_bbm};
=========================
Error display :
Error
Undefined variable: jenis
Undefined variable: tahun
Error inserting:
The statement has been terminated.
View SQL as follow :
Error
Undefined variable: jenis
Undefined variable: tahun
Error inserting:
The statement has been terminated.
View SQL
INSERT INTO dbo.bbm_transaksi (tanggal, week_bbm, month_bbm, year_bbm, depo, nomor_kendaraan, divisi, jenis_mobil, driver, merk, tahun_kendaraan, km, jml_km, liter_bbm, harga_bbm, rasio_bbm) VALUES (‘11272014’, 01, 12, 1969, ‘’, ‘L 1427 OT’, ‘’, ‘’, ‘Suyanto’, ‘’, ‘’, 30000, 100, 50, 6500, 2)
From this view SQL error,
#1. i found table master cant insert to table bbm_transaction.
#2. date 11272014, i split on week, month and year is wrong ( 01, 12, 1969)
please help, how to correct this error
Regards
Iwan Setiawan