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
>
>
|
|
|