BB
|
| Posted: 08/26/2002, 8:14 PM |
|
The code below has an error in the line that begins with
"$db->ToSQL(ds->$last_id". The CCS error reported is: Parse error: parse
error, unexpected T_OBJECT_OPERATOR.
Assumptions:
table_name_1 has 3 columns, index_id (autoincrement), description (text
field), and datex (a datetime field)
table_name_2 has 4 columns, history_index (autoincrement), index_id
(integer), description (text field), and datex (a datetime field)
I need code for the AfterInsert and AfterUpdate events in the Record
form_name_1 (goes with table_name_1) that programmatically adds a record to
table_name_2 everytime a record is added/updated in table_name_1. Can
someone point out the correction needed below?
// AFTER INSERT event for form_name_1
global $form_name_1; //form_name
global $DBMIS; //database connection
$last_id= mysql_insert_id(); // get last autoincrement value
$sSQL2="INSERT INTO table_name_2 (" .
"index_id," .
"description," .
"datex" .
") VALUES (" .
$db->ToSQL(ds->$last_id->GetValue(),ds->$last_id->DataType) .
$db->ToSQL($form_name_1->description->GetValue(),
$test1->description->DataType) .
$db->ToSQL($form_name_1->datex->GetValue(), $test1->datex->DataType) .
"')";
$DBMIS->query($sSQL2);
|
|
|
 |
BB
|
| Posted: 08/26/2002, 8:20 PM |
|
The code below has an error in the line that begins with
"$db->ToSQL(ds->$last_id". The CCS error reported is: Parse error: parse
error, unexpected T_OBJECT_OPERATOR.
Assumptions:
table_name_1 has 3 columns, index_id (autoincrement), description (text
field), and datex (a datetime field)
table_name_2 has 4 columns, history_index (autoincrement), index_id
(integer), description (text field), and datex (a datetime field)
I need code for the AfterInsert and AfterUpdate events in the Record
form_name_1 (goes with table_name_1) that programmatically adds a record to
table_name_2 everytime a record is added/updated in table_name_1. Can
someone point out the correction needed below?
// AFTER INSERT event for form_name_1
global $form_name_1; //form_name
global $DBMIS; //database connection
$last_id= mysql_insert_id(); // get last autoincrement value
$sSQL2="INSERT INTO table_name_2 (" .
"index_id," .
"description," .
"datex" .
") VALUES (" .
$db->ToSQL(ds->$last_id->GetValue(),ds->$last_id->DataType) .
$db->ToSQL($form_name_1->description->GetValue(),
$form_name_1->description->DataType) .
$db->ToSQL($form_name_1->datex->GetValue(),
$form_name_1->datex->DataType) .
"')";
$DBMIS->query($sSQL2);
|
|
|
 |
Don Anderson
|
| Posted: 08/27/2002, 4:57 PM |
|
Hi BB,
I'd be interested to know the answer to this issue myself.
The problem is probably that "(ds->$last_id " should read "($ds->last_id"
Also I'm not sure if $db->ToSQL works within an event function.
When I tried this it didn't appear to.
My solution has been to call the variables without the ToSQL().
Naturally, I'd be interested in how to make ToSQL() work inside an event.
Cheers,
Don Anderson
"BB" <blankenb@charter.net> wrote in message
news:aker65$d3v$1@news.codecharge.com...
> The code below has an error in the line that begins with
> "$db->ToSQL(ds->$last_id". The CCS error reported is: Parse error: parse
> error, unexpected T_OBJECT_OPERATOR.
>
> Assumptions:
> table_name_1 has 3 columns, index_id (autoincrement), description (text
> field), and datex (a datetime field)
> table_name_2 has 4 columns, history_index (autoincrement), index_id
> (integer), description (text field), and datex (a datetime field)
> I need code for the AfterInsert and AfterUpdate events in the Record
> form_name_1 (goes with table_name_1) that programmatically adds a record
to
> table_name_2 everytime a record is added/updated in table_name_1. Can
> someone point out the correction needed below?
>
> // AFTER INSERT event for form_name_1
>
> global $form_name_1; //form_name
> global $DBMIS; //database connection
> $last_id= mysql_insert_id(); // get last autoincrement value
>
> $sSQL2="INSERT INTO table_name_2 (" .
> "index_id," .
> "description," .
> "datex" .
> ") VALUES (" .
> $db->ToSQL(ds->$last_id->GetValue(),ds->$last_id->DataType) .
> $db->ToSQL($form_name_1->description->GetValue(),
> $form_name_1->description->DataType) .
> $db->ToSQL($form_name_1->datex->GetValue(),
> $form_name_1->datex->DataType) .
> "')";
> $DBMIS->query($sSQL2);
>
>
|
|
|
 |
|