Good afternoon!
I hope someone can help me. I try to update fields in a table, it works perfect, but when the date is empty, I have issues:
I have 2 tables: ORDER and ORDERINHOUD.
When `order`.orderbevestiging is updated, I need to update also the records `orderinhoud`.orderbevestiging when they meet some criteria as you can see below.
It works fine for other queries, but with an empty datefield in ORDER, it still updates the records in ORDERINHOUD with value 00-00-0000 And the idea is that when the value in order is empty, it does not update those records in ORDERINHOUD.
As you can see below, I tried already different things, but none of those have the result that the other table is not updated.
Hope someone can help me with this!
$sql = "UPDATE `orderinhoud`, `order`
SET `orderinhoud`.orderbevestiging = '".$values['orderbevestiging']."'
WHERE (`orderinhoud`.orderbevestiging IS NULL OR `orderinhoud`.orderbevestiging = '') AND `order`.orderbevestiging IS NOT NULL AND `order`.orderbevestiging != 0 AND `order`.orderbevestiging <>'' AND `order`.orderbevestiging <>'0-0-0000' AND `orderinhoud`.orderid='".$values['id']."'";
db_exec($sql);
I hope someone can help me. I try to update fields in a table, it works perfect, but when the date is empty, I have issues:
I have 2 tables: ORDER and ORDERINHOUD.
When `order`.orderbevestiging is updated, I need to update also the records `orderinhoud`.orderbevestiging when they meet some criteria as you can see below.
It works fine for other queries, but with an empty datefield in ORDER, it still updates the records in ORDERINHOUD with value 00-00-0000 And the idea is that when the value in order is empty, it does not update those records in ORDERINHOUD.
As you can see below, I tried already different things, but none of those have the result that the other table is not updated.
Hope someone can help me with this!
$sql = "UPDATE `orderinhoud`, `order`
SET `orderinhoud`.orderbevestiging = '".$values['orderbevestiging']."'
WHERE (`orderinhoud`.orderbevestiging IS NULL OR `orderinhoud`.orderbevestiging = '') AND `order`.orderbevestiging IS NOT NULL AND `order`.orderbevestiging != 0 AND `order`.orderbevestiging <>'' AND `order`.orderbevestiging <>'0-0-0000' AND `orderinhoud`.orderid='".$values['id']."'";
db_exec($sql);