Row Inserted function based on field value

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
noorshiam
User
Posts: 67
Location: Surabaya - East Java - Indonesia
Contact:

Row Inserted function based on field value

Post by noorshiam »

Dear All,

My PHPMaker version is 2020 and I have problem with my Row_Inserted function. I have 3 table ;

Table1
id(int) auto increment, choice(varchar), description(varchar), summary(varchar)
Table2
id(int) auto increment, description(varchar)
Table3
id(int) auto increment, summmary(varchar)

This is my Row_Inserted function on Table1:

function Row_Inserted($rsold, &$rsnew) {
$pilihan = $rsnew["choice"];
if ($pilihan = "A") {
Execute("INSERT INTO Table2 (description) VALUES('" . $rsnew["description"] . "')");
} else {
Execute("INSERT INTO Table3 (summary) VALUES('" . $rsnew["summary"] . "')");
}
}

My problem is, only INSERT INTO Table2 fired, whatever my choice field's value, I cannot insert to Table3 when my "choice" value not "A"
Anybody can help? Thanks for your kindness


sticcino
User
Posts: 1043

Post by sticcino »

if ($pilihan = "A")

shoud be:
if ($pilihan == "A")


noorshiam
User
Posts: 67
Location: Surabaya - East Java - Indonesia
Contact:

Post by noorshiam »

uuhh.... my mistake, thank you sticcino, it's worked like a charm


Post Reply