This topic is locked

Update Table If Condition from other table meet

9/24/2021 12:48:50 AM
PHPRunner General questions
K
Kaspersky author

hi, i would like to ask some help please. How to create an events for this scenario: their unique column is order_no

Table 1: customer
columns: customer name, status, order_no
Table 2: order
columns: order_no, status, date

if customer table coulmn status is COMPLETED

order table column status will be DELIVERED

both status column on tables has its own dropdowns.

i used this:

if($values["custome"] == "COMPLETED")

{

DB::Query("UPDATE order SET status ='DELIVERED' where order.order_no= customer.order_no");

}

but its not working. Help please.

A
acpan 9/24/2021

First look, your DB API syntax is wrong. Use DB::Exec in place of DB::Query
Or you can also use DB::Update (with parameterized data).

Referr to DB API for more info..

And then, not sure your if statement with field custome is a typo mistake?