This topic is locked

Change a value after add

5/8/2009 1:03:37 PM
PHPRunner General questions
lewisgr author

Hello,
After I add a record I want the Unique Id I assigned to go to the table where the dropdown is coming from and change 0 to -1.
Tbl_uniqueID:

UniqueAutoID (autonumber)

UniqueID (primary key)

Use (where the 0 or -1 is)

DateForUse (the date on which the record can be used)
I know i'll have to use the after add event but that about it. I'll keep at it but if anyone can help a little, it would really help.
Thanks

lewisgr author 5/8/2009

I thought i found something that would work but it didn't here it is:

$dal->$tbl_uniqueid->Param["UniqueID"]=$values["UBinID"]; // Find the value in tbl_uniqueid that equal the value in UBinID

$dal->$tbl_uniqueid->Value["Use"]="-1"; // Switch the field from 0 to -1

$dal->$tbl_uniqueid->Update(); // Make the update


Hello,

After I add a record I want the Unique Id I assigned to go to the table where the dropdown is coming from and change 0 to -1.
Tbl_uniqueID:

UniqueAutoID (autonumber)

UniqueID (primary key)

Use (where the 0 or -1 is)

DateForUse (the date on which the record can be used)
I know i'll have to use the after add event but that about it. I'll keep at it but if anyone can help a little, it would really help.
Thanks

lewisgr author 5/8/2009

Here the latest and of course it didn't work:

global $conn;

$strUpdate = "

UPDATE tbl_uniqueid

SET tbl_uniqueid.uniqueid =

(SELECT tbl_uniqueid.UniqueID,

tbl_uniqueid.Used,

FROM tbl_uniqueid

WHERE tbl_uniqueid.UniqueID=$values["UBinID"]

AND '" tbl_uniqueid.Used=-1"')";

db_exec($strUpdate,$conn);


Any Idea's?

J
Jane 5/11/2009

Hi,
please see my changes below:

$dal->tbl_uniqueid->Param["UniqueID"]=$values["UBinID"];

$dal->tbl_uniqueid->Value["Use"]="-1";

$dal->tbl_uniqueid->Update();

lewisgr author 5/11/2009

Hi Jane,
Thanks for the help, but it didn't work. I put this code in the "After Record Added" event:

global $dal;

$dal->tbl_uniqueid->Param["UniqueID"]=$values["UBinID"]; // Find the value in tbl_uniqueid that equal the value in UBinID

$dal->tbl_uniqueid->Value["Used"]="-1"; // Switch the field from 0 to -1

$dal->tbl_uniqueid->Update(); // Make the update


Is that the correct event to add this code to or is there a better event. I have tried a few others but it didn't seem to matter.
Thanks

Hi,

please see my changes below:

J
Jane 5/12/2009

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.