This topic is locked

Write a value to another table

8/21/2008 1:36:35 PM
PHPRunner General questions
J
jskewes author

Hi-

Can anyone tell me or point me to a previous answer to this question?
I have two tables. Cars & GetReady.
--> After a user makes any entry in GetReady I would like a value of "1" to be written into a field called 'posted' in the Cars table.
--> the reason for this is to use it as a control. Once a Getready has been posted and there is a value of "1" in the record in the Cars table, that stock number will no longer be available (in a dynamic list of stock numbers).
thanks

/john

J
Jane 8/22/2008

John,
use Before record added event on the Events tab fpr this purpose.

Here is just a sample:

global $conn;

$strUpdate = "update TableName set FieldName=1 where RecordID=...";

db_exec($strUpdate,$conn);

J
jskewes author 8/22/2008

Hi Jane,

Thanks for responding.

I insert this code in Before Record added / other / custom code.

I have written it to read;
global $conn;

$strUpdate = "update Cartable set Posted=1 where StockNumber=...";

db_exec($strUpdate,$conn);
? How is the proper record identified?
I get an error on line 26 of getready_add.php where it reads;

if(@$_REQUEST["editType"]=="inline")

$inlineedit=ADD_INLINE;

elseif(@$_REQUEST["editType"]=="onthefly")

$inlineedit=ADD_ONTHEFLY;

........................
Thanks Jane

John,

use Before record added event on the Events tab fpr this purpose.

Here is just a sample:

J
Jane 8/22/2008

John,
all entered values are stored in the $values array, I.e.

$strUpdate = "update Cartable set Posted=1 where StockNumber=".$values["FieldName"];