This topic is locked
[SOLVED]

 Mysql error 256 please help!

4/20/2017 11:19:12 PM
PHPRunner General questions
Z
Zerobaka author

Hello people, sorry but i need help, so pleeease.
This is what happened when i test my codes of add new record, on my project::

(ps: i am Indonesian, so pardon my english)



php terjadi kesalahan

Informasi teknis
Jenis kesalahan 256

Deskripsi kesalahan You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', '579670790108', '0', '0', '2017-04-21 02:18:38', '170421021838', '0')' at line 1

URL localhost/notarisku6/titipan_add.php?submit=1&fly=1&

File kesalahan C:\UniServer\www\notarisku6\connections\Connection.php

Garis kesalahan 642

Query SQL INSERT INTO status (id_jenis_invoice, no_invoice, nama_klien, harga_total, id_bank, stlunas, tgl_buat, kode, id_user) values (2, '61/TTP/IV/2017', lksdjvlsrvklsrmvkslvresvnes', '579670790108', '0', '0', '2017-04-21 02:18:38', '170421021838', '0')
Call stack

File: line Function Arguments

#0. connections\Connection.php:642 trigger_error 1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', '579670790108', '0', '0', '2017-04-21 02:18:38', '170421021838...;

2. 256;

#1. connections\Connection.php:642 Connection->triggerError 1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', '579670790108', '0', '0', '2017-04-21 02:18:38', '170421021838...;

#2. connections\MySQLiConnection.php:143 MySQLiConnection->query 1. INSERT INTO status (id_jenis_invoice, no_invoice, nama_klien, harga_total, id_bank, stlunas, tgl_buat, kode, id_user) values (2, '61/TTP/IV/2017', lksdjvlsrvklsrmvkslvresvnes', '579670790108', '0', '0...;

#3. include\dal.php:24 CustomQuery 1. INSERT INTO status (id_jenis_invoice, no_invoice, nama_klien, harga_total, id_bank, stlunas, tgl_buat, kode, id_user) values (2, '61/TTP/IV/2017', lksdjvlsrvklsrmvkslvresvnes', '579670790108', '0', '0...;

#4. include\titipan_events.php:155 eventclass_titipan->BeforeAdd 1. Array ( [id_notaris] => 1 [nama_klien] => lksdjvlsrvklsrmvkslvresvnes [order1] => dfgmdlrkgmerlkbmeslvdlkn [harga1] => 234324354363 [order2] => sdfvdfbfdbfgdngffb v [harga2] =>...;

2. ;

3. ;

4. AddPage;

#5. classes\addpage.php:567 AddPage->callBeforeAddEvent N/A

#6. classes\addpage.php:399 AddPage->processDataInput N/A

#7. classes\addpage.php:312 AddPage->process N/A

#8. titipan_add.php:259 Global scope N/A


And this is my status table SQL structure::



SELECT

id_status,

id_jenis_invoice,

no_invoice,

nama_klien,

harga_total,

sudah_bayar,

id_bank,

stlunas,

tgl_lunas,

DATEDIFF(CURDATE(), tgl_buat) AS umur,

harga_total - sudah_bayar AS saldo,

tgl_buat,

kode,

id_user

FROM status

ORDER BY id_status DESC


Of course the actual table does not contain the two formulatic field as seen above.

And, this is the codes that generated the above error (hopefully i dont pick the wrong code to stare)::

Ps: the code located on 'Add page' - 'Before record added' section



// Save status piutang of this invoice

$sql = "INSERT INTO status (id_jenis_invoice, no_invoice, nama_klien, harga_total, id_bank, stlunas, tgl_buat, kode, id_user) values (" .

"2, '" .

$nomor . "', " .

$values['nama_klien'] . "', '" .

$values['harga_total'] . "', '" .

"0', '" .

"0', '" .

$values['tgl_buat'] . "', '" .

$values['kode'] . "', '" .

$_SESSION["OwnerID"] . "')";

$res = CustomQuery($sql);


Well, everyone, any clues of what is going on, how many time i stare at them, i could not figure out what is wrong.

Please, help me.
Best regards, Abe

Z
Zerobaka author 4/21/2017

Thank god, people, i found the culprit. I got a clue from somewhere, that you must use quote mark to insert text or date type.

Then i realize i miss a quote in my php code, right at the line with $nomor variable.
There, once it fixed, my project runs smoothly.
Best regards, Abe