CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 error in afterinsert event

Print topic Send  topic

Author Message
Dharma Mulya
Posted: 12/25/2002, 7:53 PM

I have used the following afterinsert event to insert data into two tables
which has similar fieldnames. I used php with ccs on apache server. When the
form is executed I recieve the following error message?

"Fatal error: Call to a member function on a non-object in
...\user_preregister_events.php on line 32".
** line 32 read as below

. $Internet_Keahlian->ToSQL($last_id, ccsInteger) . ", "

** what is wrong with this code line ???

Can somebody please help me? Thank you in advance.



<?php
//BindEvents Method @1-565FC795
function BindEvents()
{
global $preregister;
$preregister->CCSEvents["AfterInsert"] = "preregister_AfterInsert";
}
//End BindEvents Method

function preregister_AfterInsert() { //preregister_AfterInsert @4-44B4D082

//Custom Code @25-2A29BDB7
// -------------------------
// Write your own code here.

global $Internet_Keahlian; // data connection
global $users; // form name

$last_id = mysql_insert_id(); // get last autoincrement number from
record just inserted

$sSQL = "INSERT INTO `receipt` ("
. "`user_id`, "
. "`date_add`, "
. "`first_name`, "
. "`last_name`, "
. "`dist_code`, "
. "`sponsor_id`, "
. "`user_login`, "
. "`user_password`, "
. "`email`, "
. ") VALUES ("
. $Internet_Keahlian->ToSQL($last_id, ccsInteger) . ", "
. $Internet_Keahlian->ToSQL($users->date_add->GetDBValue(),
$users->ds->date_add->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->first_name->GetDBValue(),
$users->ds->first_name->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->last_name->GetDBValue(),
$users->ds->last_name->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->dist_code->GetDBValue(),
$users->ds->dist_code->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->sponsor_id->GetDBValue(),
$users->ds->sponsor_id->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->user_login->GetDBValue(),
$users->ds->user_login->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->user_password->GetDBValue(),
$users->ds->user_password->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->email->GetDBValue(),
$users->ds->email->DataType)
. ")";

$Internet_Keahlian->query($sSQL);

// -------------------------
//End Custom Code

} //Close preregister_AfterInsert @4-FCB6E20C


?>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.431 / Virus Database: 242 - Release Date: 12/17/02

RonB
Posted: 12/26/2002, 3:54 AM

could you post the complete event code. The error states that you are trying
to do something with a non existing object or a non existing part of an
object. Generaly this means you forgot to add global $somegrid;
or a typing error in the global part.


RonB


"Dharma Mulya" <dharma@supreme.com.my> schreef in bericht
news:auduf1$mii$1@news.codecharge.com...
> I have used the following afterinsert event to insert data into two tables
> which has similar fieldnames. I used php with ccs on apache server. When
the
> form is executed I recieve the following error message?
>
> "Fatal error: Call to a member function on a non-object in
> ..\user_preregister_events.php on line 32".
> ** line 32 read as below
>
> . $Internet_Keahlian->ToSQL($last_id, ccsInteger) . ", "
>
> ** what is wrong with this code line ???
>
> Can somebody please help me? Thank you in advance.
>
>
>
> <?php
> //BindEvents Method @1-565FC795
> function BindEvents()
> {
> global $preregister;
> $preregister->CCSEvents["AfterInsert"] = "preregister_AfterInsert";
> }
> //End BindEvents Method
>
> function preregister_AfterInsert() { //preregister_AfterInsert @4-44B4D082
>
> //Custom Code @25-2A29BDB7
> // -------------------------
> // Write your own code here.
>
> global $Internet_Keahlian; // data connection
> global $users; // form name
>
> $last_id = mysql_insert_id(); // get last autoincrement number from
> record just inserted
>
> $sSQL = "INSERT INTO `receipt` ("
> . "`user_id`, "
> . "`date_add`, "
> . "`first_name`, "
> . "`last_name`, "
> . "`dist_code`, "
> . "`sponsor_id`, "
> . "`user_login`, "
> . "`user_password`, "
> . "`email`, "
> . ") VALUES ("
> . $Internet_Keahlian->ToSQL($last_id, ccsInteger) . ", "
> . $Internet_Keahlian->ToSQL($users->date_add->GetDBValue(),
> $users->ds->date_add->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->first_name->GetDBValue(),
> $users->ds->first_name->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->last_name->GetDBValue(),
> $users->ds->last_name->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->dist_code->GetDBValue(),
> $users->ds->dist_code->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->sponsor_id->GetDBValue(),
> $users->ds->sponsor_id->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->user_login->GetDBValue(),
> $users->ds->user_login->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->user_password->GetDBValue(),
> $users->ds->user_password->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->email->GetDBValue(),
> $users->ds->email->DataType)
> . ")";
>
> $Internet_Keahlian->query($sSQL);
>
> // -------------------------
> //End Custom Code
>
> } //Close preregister_AfterInsert @4-FCB6E20C
>
>
> ?>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.431 / Virus Database: 242 - Release Date: 12/17/02
>
>

DonB
Posted: 12/26/2002, 5:43 PM

ToSQL syntax is "object.ToSQL(Value, Valuetype)"

What is the "object" in your case? I think maybe you meant to use the
function "CCToSQL"

DonB



"Dharma Mulya" <dharma@supreme.com.my> wrote in message
news:auduf1$mii$1@news.codecharge.com...
> I have used the following afterinsert event to insert data into two tables
> which has similar fieldnames. I used php with ccs on apache server. When
the
> form is executed I recieve the following error message?
>
> "Fatal error: Call to a member function on a non-object in
> ..\user_preregister_events.php on line 32".
> ** line 32 read as below
>
> . $Internet_Keahlian->ToSQL($last_id, ccsInteger). ", "
>
> ** what is wrong with this code line ???
>
> Can somebody please help me? Thank you in advance.
>
>
>
> <?php
> //BindEvents Method @1-565FC795
> function BindEvents()
> {
> global $preregister;
> $preregister->CCSEvents["AfterInsert"] = "preregister_AfterInsert";
> }
> //End BindEvents Method
>
> function preregister_AfterInsert() { //preregister_AfterInsert @4-44B4D082
>
> //Custom Code @25-2A29BDB7
> // -------------------------
> // Write your own code here.
>
> global $Internet_Keahlian; // data connection
> global $users; // form name
>
> $last_id = mysql_insert_id(); // get last autoincrement number from
> record just inserted
>
> $sSQL = "INSERT INTO `receipt` ("
> . "`user_id`, "
> . "`date_add`, "
> . "`first_name`, "
> . "`last_name`, "
> . "`dist_code`, "
> . "`sponsor_id`, "
> . "`user_login`, "
> . "`user_password`, "
> . "`email`, "
> . ") VALUES ("
> . $Internet_Keahlian->ToSQL($last_id, ccsInteger) . ", "
> . $Internet_Keahlian->ToSQL($users->date_add->GetDBValue(),
> $users->ds->date_add->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->first_name->GetDBValue(),
> $users->ds->first_name->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->last_name->GetDBValue(),
> $users->ds->last_name->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->dist_code->GetDBValue(),
> $users->ds->dist_code->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->sponsor_id->GetDBValue(),
> $users->ds->sponsor_id->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->user_login->GetDBValue(),
> $users->ds->user_login->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->user_password->GetDBValue(),
> $users->ds->user_password->DataType) . ", "
> . $Internet_Keahlian->ToSQL($users->email->GetDBValue(),
> $users->ds->email->DataType)
> . ")";
>
> $Internet_Keahlian->query($sSQL);
>
> // -------------------------
> //End Custom Code
>
> } //Close preregister_AfterInsert @4-FCB6E20C
>
>
> ?>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.431 / Virus Database: 242 - Release Date: 12/17/02
>
>

Dharma Mulya
Posted: 12/26/2002, 11:27 PM

This is the full code I copied from the afterinsert event,

<?php
//BindEvents Method @1-565FC795
function BindEvents()
{
global $preregister;
$preregister->CCSEvents["AfterInsert"] = "preregister_AfterInsert";
}
//End BindEvents Method

function preregister_AfterInsert() { //preregister_AfterInsert @4-44B4D082

//Custom Code @25-2A29BDB7
// -------------------------
// Write your own code here.

global $Internet_Keahlian; // data connection
global $users; // form name

$last_id = mysql_insert_id(); // get last autoincrement number from
record just inserted

$sSQL = "INSERT INTO `receipt` ("
. "`user_id`, "
. "`date_add`, "
. "`first_name`, "
. "`last_name`, "
. "`dist_code`, "
. "`sponsor_id`, "
. "`user_login`, "
. "`user_password`, "
. "`email`, "
. ") VALUES ("
. $Internet_Keahlian->ToSQL($last_id, ccsInteger) . ", "
. $Internet_Keahlian->ToSQL($users->date_add->GetDBValue(),
$users->ds->date_add->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->first_name->GetDBValue(),
$users->ds->first_name->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->last_name->GetDBValue(),
$users->ds->last_name->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->dist_code->GetDBValue(),
$users->ds->dist_code->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->sponsor_id->GetDBValue(),
$users->ds->sponsor_id->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->user_login->GetDBValue(),
$users->ds->user_login->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->user_password->GetDBValue(),
$users->ds->user_password->DataType) . ", "
. $Internet_Keahlian->ToSQL($users->email->GetDBValue(),
$users->ds->email->DataType)
. ")";

$Internet_Keahlian->query($sSQL);

// -------------------------
//End Custom Code

} //Close preregister_AfterInsert @4-FCB6E20C


?>


"RonB" <r.borkent@123chello123.nl> wrote in message
news:aueqm5$a9s$1@news.codecharge.com...
> could you post the complete event code. The error states that you are
trying
> to do something with a non existing object or a non existing part of an
> object. Generaly this means you forgot to add global $somegrid;
> or a typing error in the global part.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.431 / Virus Database: 242 - Release Date: 12/17/02


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.