This topic is locked
[SOLVED]

 Button Code

4/4/2019 11:21:02 AM
PHPRunner General questions
P
PaulM author

Hi,
I'm trying to make a button and when pushed I want to insert a record into a table but I get a code validation error. Could you please tell me what I'm doing wrong?
Thanks in advance
DB::Exec("insert into Dummy_Table(DT_details) values('abc')");

A
ayctech 4/4/2019

$sql = "INSERT INTO new_plantel_instructores (id_instituto, id_persona,fecha_insercion) values ($id_instituto, ".$values['id_persona'].",'".$fecha_actual."')";

CustomQuery($sql);

P
PaulM author 4/5/2019



$sql = "INSERT INTO new_plantel_instructores (id_instituto, id_persona,fecha_insercion) values ($id_instituto, ".$values['id_persona'].",'".$fecha_actual."')";

CustomQuery($sql);


Thank you. I have now updated the code but when I click on the button nothing happens, it doesn't insert anything into the Dummy Table.

admin 4/5/2019

I recommend to use Database API:

https://xlinesoft.com/phprunner/docs/db_insert.htm
Syntax is easier and less error prone.
Also check this:

https://xlinesoft.com/phprunner/docs/troubleshooting_custom_buttons.htm