This topic is locked

Stok Update

6/26/2018 6:48:54 AM
PHPRunner General questions
S
shiftman author

Hello,
I have two table.
Fırst table
Hammadde

HammaddeNo (int)AI

Hammadde (Varchar)

HamStok (Varchar)
Second Table
Paketle

PaketNo (int) AI

Urun (Varchar) ///This field can be select lookup wizard

Kilo (Varchar)
I need to when i fill paketle table

Hammadde table HamStok update from Paketle Kilo
Could u help me ?

S
shiftman author 6/26/2018

i found sol.
global $conn;

$strSQLUpdate = "UPDATE Hammadde SET SokStok = SokStok + '".$values["CikisKilo"]."' WHERE Hammadde ='".$values["Urun"]."'";

db_exec($strSQLUpdate,$conn);
But now how can i update table when list row deleted ?

M
mersintarim 6/26/2018

write your code to before delete event

global $dal;

$tblAcc = $dal->Table("Accounting");

$tblAcc->Param["AorderNUM"] =$deleted_values["PorderNUM"];

$tblAcc->update();

S
shiftman author 6/26/2018



write your code to before delete event

global $dal;

$tblAcc = $dal->Table("Accounting");

$tblAcc->Param["AorderNUM"] =$deleted_values["PorderNUM"];

$tblAcc->update();


Not Work

M
mersintarim 6/27/2018



Not Work


table value, param value and $deleted_values is your parameters. Change please this values your values.

S
shiftman author 7/1/2018



table value, param value and $deleted_values is your parameters. Change please this values your values.


Not Work For me

Sergey Kornilov admin 7/2/2018

You are not providing enough info for anyone to help you.
Instead of using DAL functions build your SQL query manually and execute it. It will be easier to troubleshoot it this way as you can print your SQL query on the page and make sure it looks correct.

S
shiftman author 7/2/2018



You are not providing enough info for anyone to help you.
Instead of using DAL functions build your SQL query manually and execute it. It will be easier to troubleshoot it this way as you can print your SQL query on the page and make sure it looks correct.


I mean when i delete something from second table it will be update first table "kilo"

Sergey Kornilov admin 7/2/2018

This is exactly what I mean. My recommendation is to do that using a SQL query, similar to one you posted in the beginning of this thread.