This topic is locked

Change row values after printing

1/6/2010 6:53:02 PM
PHPRunner General questions
B
bedri author

Hello PhpRunner!
I need to automatically change a specific row values of the records which I print.

To be clear.

Example: I have 5 records and I select them for printing, now after this records are printed I want a row value which is "Status" for each record to be automatically changed from "Open" to "Pending" for all these 5 selected records.
I think you can understand what I mean...
Ok thanks for the great job you do.

Kind Regards

J
Jane 1/7/2010

Hi,
use Print page: Before display event to update printed records.

Here is just a sample:

global $strWhereClause,$conn;

$strUpdate = "update tablename set status='pending' where ".$strWhereClause;

db_exec($strUpdate,$conn);
B
bedri author 1/11/2010



Hi,
use Print page: Before display event to update printed records.

Here is just a sample:

global $strWhereClause,$conn;

$strUpdate = "update tablename set status='pending' where ".$strWhereClause;

db_exec($strUpdate,$conn);



Thanks a lot Jane.
It does my job in the new version 5.1 but I have combination of files with an older version of PhpRunner 5.0(I think so..) and the new one, in the older version it is used [$smarty] variable and here we have the [$xt] variable, sorry but i am new in php so do you have any idea how I can do this with [$smarty] variable..

I use the older version just for the [xxx_print.php] files, and the other files are created with the version 5.1
Kind Regards

J
Jane 1/12/2010

Hi,
I'm not sure that I understand your question.

There is no $xt or $smarty variable in my sample code.

B
bedri author 1/12/2010



Hi,
I'm not sure that I understand your question.

There is no $xt or $smarty variable in my sample code.


Ok Jane I solved the problem,

with $xt and $smarty I was thinking about the variables that are called or referred within the function BeforeShowPrint.
Now I have another question.
In the field 'Status' I have three values "Open" "Pending" and "Closed" with your code it changes the "Closed" to "Pending" too, but I want just the "Open" to be changed, after printing.
I tried $strUpdate = "update tablename set status='pending' where status='open'; but this changes all my records not only those which I want to print. I hope you can understand me.
Thanks.

J
Jane 1/13/2010

Please see my changes below:

$strUpdate = "update tablename set status='pending' where status='open' and ".$strWhereClause;