CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Fatal error: Call to a member function ToSQL() on a non-object in ...

Print topic Send  topic

Author Message
Jeff Walters
Posted: 12/11/2004, 3:11 AM

I am trying to replicate the functionality demonstrated in the example -
Multiple Form registration - for a very small application.

I first copied the code / applied it to an After Insert code embed.

I got the above really meaningful message.

I've tested the provided example in PHP- works fine.

Final attempt - I copied the Users table into my database, copied the
MultipleRegistration1 set of files into my project - i.e. appart from
changing the name of the connection in the form and in the embedded code, I
have changed nothing. Once again I get this meaningless message. Moving the
page from a working application to a simple 3 page application with the
identical project settings (from what I can see) results in the code
failing.

Help please - this is driving me nuts. A quick and simple database
application is now starting waste hours of my time trying to figure this
out.

The code - the $LastID line is causing the problem.

=======================

//Custom Code @18-0C2E498F
// -------------------------
global $Entrants;
global $DBCn;
global $Redirect;


//Retrieve the last inserted ID for the Entrant

$LastID =
CCDLookup("max(EntrantID)","Entrants","IPAddress=".$DBCn->ToSQL(CCGetFromPos
t("IPAddress",""),ccsText),$DBCn);

if (strpos($Redirect,"?") == false ) {
$Redirect = $Redirect."?EntrantID=".$LastID;
} else if (substr($Redirect,-1) == "?" ) {
$Redirect = $Redirect."EntrantID=".$LastID;
} else {
$Redirect = $Redirect."&EntrantID=".$LastID;
}


Jeff

mrachow


Posts: 509
Posted: 12/11/2004, 4:29 AM

If $DBCn is the right name of your database connection than you have to write a global statement for every already defined variable you would like to use in your custom code.
Here
global $DBCn;
_________________
Best regards,
Michael
View profile  Send private message
Jeff Walters
Posted: 12/11/2004, 2:46 PM

Solved

Legacy of having come from ASP / ASP.Net - it was a case issue - DBcn, and
not DBCn

Thanks


"mrachow" <mrachow@forum.codecharge> wrote in message
news:541bae81338c51@news.codecharge.com...
> If $DBCn is the right name of your database connection than you have to
write a
> global statement for every already defined variable you would like to use
in
> your custom code.
> Here
> global $DBCn;
> _________________
> Regards,
> Michael
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Last Hero
Posted: 12/11/2004, 3:03 PM

try
$DBCn = new $clsDBCn();

Add new topic Subscribe to topic   


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

Web Database

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.