This topic is locked

update record from the print page

6/12/2008 2:08:10 PM
PHPRunner General questions
T
thesofa author

Hi

I have read the post here

http://www.asprunner.com/forums/index.php?showtopic=8714

and I have modified my page to do a similatr thing,

BUT, my SQL string that forms the basis of the query for the pages has a field `printed` so my query is in the form of

SELECT

concat(Surname, ', ', Forename) AS Pupil,

Reg,

ID_pup,

Intake,

Gender,

cont,

att,

beh,

com,

more_com,

printed

FROM pupils

WHERE pupils.printed IS NULL = True AND pupils.more_com IS NOT NULL



in the Print page:BeforeSQL Query event, I have the following code

global $conn;

$strUpdate = "update `pupils` set printed = '1' where (".$strWhereClause.")";

db_exec($strUpdate,$conn);



So when I select any records to print, they are updated BEFORE they are selected by the query, and thus not printed.
OK, OK I know I am stupid.

is there any way I can set this field to "1" AFTER the printing has taken place?

TIA

R
rainerwolf 6/13/2008

Hi

I have read the post here

http://www.asprunner.com/forums/index.php?showtopic=8714

and I have modified my page to do a similatr thing,

BUT, my SQL string that forms the basis of the query for the pages has a field `printed` so my query is in the form of

SELECT

concat(Surname, ', ', Forename) AS Pupil,

Reg,

ID_pup,

Intake,

Gender,

cont,

att,

beh,

com,

more_com,

printed

FROM pupils

WHERE pupils.printed IS NULL = True AND pupils.more_com IS NOT NULL



in the Print page:BeforeSQL Query event, I have the following code

global $conn;

$strUpdate = "update `pupils` set printed = '1' where (".$strWhereClause.")";

db_exec($strUpdate,$conn);



So when I select any records to print, they are updated BEFORE they are selected by the query, and thus not printed.
OK, OK I know I am stupid.

is there any way I can set this field to "1" AFTER the printing has taken place?

TIA

R
rainerwolf 6/13/2008

Hi,
very good question and not stupid, I am looking for the same function.
Rainer

T
thesofa author 6/16/2008

Hi,

very good question and not stupid, I am looking for the same function.
Rainer



So, can I modify a button or place a button on the page to update the records I have printed after the printing takes place?

Failing that, I shall have to do an inline edit which can lead to mistakes as users are allegedly human.

J
Jane 6/17/2008

Hi,
you can place this code to the Print page: Before display event.

Just declare $strWhereClause as global variable.

T
thesofa author 6/18/2008

Hi,

you can place this code to the Print page: Before display event.

Just declare $strWhereClause as global variable.



If I do that, the field gets updated and then no records are displayed cos the field is not NULL

J
Jane 6/18/2008

Print page: Before display event is executed after page is processed and ready to be displayed in the browser.