Peter
|
| Posted: 03/28/2002, 5:48 AM |
|
Please help me with the following problem:
I have a form, into which three data are loaded:
field "user_id" (a session variable)
field "Date" (is the current date)
field "Trn" (over external URL loaded)
How can I automaticly store the data into a table named "users_temp" directly after opening the website (the form) ?
The fieldnames in the table correspond to the fieldnames in the form (Trn, user_id, Date).
Into which event of the form generated by codecharge must I write the appropriate script? - if it goes. Thank you for your support
Peter
Excuse my broken english!
|
|
|
 |
Peter
|
| Posted: 03/28/2002, 5:51 AM |
|
I forgot: I'm programming in PHP4 with Templates
Peter
|
|
|
 |
Nicole
|
| Posted: 03/28/2002, 6:48 AM |
|
Peter,
it could be done via custom code in Before Show event of the form. Create custom insert sql that will include values of loading table fields and execute it. E.g.:
$sSQLi = "insert into users_temp (field1, field2, field3) values (". ToSQL($flduser_id, "Number").", ". ToSQL($fldDate, "Text").", ". ToSQL($fldTrn, "Text").")";
global $db;
$db_n = new DB_Sql();
$db_n->Database = $db->Database;
$db_n->User = $db->User;
$db_n->Password = $db->Password;
$db_n->Host = $db->Host;
$db_n->query($sSQLi);
You should open new connection to db because mentioned code will be executed inside "while" loop that is based on the result of other sql query. And new connection is need in order not to overwrite query results.
|
|
|
 |
Peter
|
| Posted: 03/28/2002, 8:00 AM |
|
Thanks very much for your quick help, nicole
that's exactly what i needed. it works great.
greetings from
peter
|
|
|
 |
|