CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 php after insert

Print topic Send  topic

Author Message
wanaka
Posted: 05/21/2003, 5:42 AM

I am using postgres with php and ccs. The following is my after insert event
global $Redirect;
global $contact_person;
global $fldcpid;
global $db;

$lastname = $contact_person->lastname->GetValue();
$firstname = $contact_person->firstname->GetValue();
$SQL="select cpid from contact_person where lastname=" . "'$lastname'" . "
AND firstname=" . "'$firstname'";
$db->query($SQL);
$fldcpid = $db->f(cpid);
$Redirect .= "cpid=" . $fldcpid;

Based on the lastname and firstname input in the form I will query the
database and get the cpid (Primary Key). But I keep getting this error.

Fatal error: Call to a member function on a non-object in
/home/httpd/insert_contact_events.php on line 26

Robert Rodgers
Posted: 05/21/2003, 5:57 AM

Which line is #26?

--
"Every absurdity has a champion to defend it"
Oliver Goldsmith
++++++++++++++++++++++++++++++

"wanaka" <wanaka@hotmail.com> wrote in message
news:bafs6m$1vc$1@news.codecharge.com...
I am using postgres with php and ccs. The following is my after insert event
global $Redirect;
global $contact_person;
global $fldcpid;
global $db;

$lastname = $contact_person->lastname->GetValue();
$firstname = $contact_person->firstname->GetValue();
$SQL="select cpid from contact_person where lastname=" . "'$lastname'" . "
AND firstname=" . "'$firstname'";
$db->query($SQL);
$fldcpid = $db->f(cpid);
$Redirect .= "cpid=" . $fldcpid;

Based on the lastname and firstname input in the form I will query the
database and get the cpid (Primary Key). But I keep getting this error.

Fatal error: Call to a member function on a non-object in
/home/httpd/insert_contact_events.php on line 26


RonB
Posted: 06/02/2003, 5:33 AM

-> global $db;
instantiate the class first->
$db=new clsDBConnectionname();
now you can use it and do not have to dclare it as a global.

the code then should look like:

global $Redirect;
global $contact_person;
global $fldcpid;

$db=new clsDBConnectionname();

$lastname = $contact_person->lastname->GetValue();
$firstname = $contact_person->firstname->GetValue();
$SQL="select cpid from contact_person where lastname=" . "'$lastname'" . "
AND firstname=" . "'$firstname'";
$db->query($SQL);
$fldcpid = $db->f(cpid);
$Redirect .= "cpid=" . $fldcpid;
unset($db);

Ron


"wanaka" <wanaka@hotmail.com> schreef in bericht
news:bafs6m$1vc$1@news.codecharge.com...
> I am using postgres with php and ccs. The following is my after insert
event
> global $Redirect;
> global $contact_person;
> global $fldcpid;
> global $db;
>
> $lastname = $contact_person->lastname->GetValue();
> $firstname = $contact_person->firstname->GetValue();
> $SQL="select cpid from contact_person where lastname=" . "'$lastname'" . "
> AND firstname=" . "'$firstname'";
> $db->query($SQL);
> $fldcpid = $db->f(cpid);
> $Redirect .= "cpid=" . $fldcpid;
>
> Based on the lastname and firstname input in the form I will query the
> database and get the cpid (Primary Key). But I keep getting this error.
>
> Fatal error: Call to a member function on a non-object in
> /home/httpd/insert_contact_events.php on line 26
>
>


   


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

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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