This topic is locked

Insert a value

8/7/2007 3:16:02 PM
PHPRunner General questions
H
horsey_kim author

I am wanting to update the database when print feature is checked and initiated. I tried to use the event by the following:
global $conn;

$strSQLInsert = "insert into _seeddata (printblue) values (".$values["done"].")";

db_exec($strSQLInsert,$conn);
I wanted the value of done to show up in the printblue field of the same table.
I get this error "Undefined variable: values"
Help
Kim <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=5929&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

Sergey Kornilov admin 8/7/2007

Kim,
print page work with dataset that consists of several data records.

$values["done"] doesn't mean anything on the print page as it only works on a single-record pages like View/Edit/Add.
Probably a little clarification is required.

H
horsey_kim author 1/21/2008

Okay I hope I clarify this better. sorry took so long to get back to this.
From the list page, the user checks select boxes of lines he wants to print, then he selects the print button. Up pops the print page.
What I want is when he clicks that print button on the list page I want also the records updated for each line item he selected to send a value of "done" to the printblue field in my _seeddata table
Sorry for the confusion,
Kim

J
Jane 1/22/2008

Kim,
use Print page: Before SQL query event for this purpose.

Here is a sample:

global $conn;

$strUpdate = "update _seeddata set printblue='done' where (".$strWhereClause.")";

db_exec($strUpdate,$conn);