CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Fatal error: Class 'clsDBConnection1' not found

Print topic Send  topic

Author Message
cdolson

Posts: 27
Posted: 06/01/2006, 11:58 AM

I am getting the following error in some custom code in one of my Record forms:

Fatal error: Class 'clsDBConnection1' not found in Q:\master\wamp\www\tici\item_update_events.php on line 24

The is all happening in the BeforeShow event in the Record.

The custom code I am using was supplied directly from the CodeCharge Help File under Examples and Techniques > Programming > Working with Databases > Utilize MySQL Enum Field Type.

My code is as follows:

  
//item_detail1_BeforeShow @53-FBAAF116  
function item_detail1_BeforeShow(& $sender)  
{  
    $item_detail1_BeforeShow = true;  
    $Component = & $sender;  
    $Container = CCGetParentContainer($sender);  
    global $item_detail1; //Compatibility  
//Being Custom Code Manual Entry  
//-------------------------  
global $item_detail1;  
   
  $SQL = "SHOW COLUMNS FROM tici_items LIKE 'metal_ty'";  
  
// Open the connection  
  $db = new clsDBConnection1();  
  $db->query($SQL);  
  $Result =  $db->next_record();  
  if($Result) {  
    $Enumfield = $db->f(1);   
  }  
  $db->close();   
    
// Parse string from DB   
  if ($Enumfield != "") {  
    $Enumfield = str_replace("'","",substr($Enumfield,6,strlen($Enumfield)-7));  
    $ArrayEnum = split(",",$Enumfield);  
    foreach ($ArrayEnum as $value) {   
       $values[] = array($value,$value);  
    }  
    $item_detail1->metal_ty->Values = $values;  
  }  
  
}  
//---------------------------  
//End Custom Code Manual Entry  
//End item_detail1_BeforeShow  
  
//Close item_detail1_BeforeShow @53-5EF84DA1  
    return $item_detail1_BeforeShow;  
//End Close item_detail1_BeforeShow  
  
  
?>  
View profile  Send private message
DonB
Posted: 06/01/2006, 12:55 PM

Did you CREATE a Connection1 within the project, and publish the complete
project? I'd also take the () off the connection name, as this may not be
valid. All I can say for sure is I never do that.

--
DonB

http://www.gotodon.com/ccbth


"cdolson" <cdolson@forum.codecharge> wrote in message
news:5447f38cbc250f@news.codecharge.com...
> I am getting the following error in some custom code in one of my Record
forms:
>
>
Fatal error: Class 'clsDBConnection1' not found in  
> Q:\master\wamp\www\tici\item_update_events.php on line 24
>
> The is all happening in the BeforeShow event in the Record.
>
> The custom code I am using was supplied directly from the CodeCharge Help
File
> under Examples and Techniques > Programming > Working with Databases >
Utilize
> MySQL Enum Field Type.
>
> My code is as follows:
>
>
  
> //item_detail1_BeforeShow @53-FBAAF116  
> function item_detail1_BeforeShow(& $sender)  
> {  
>     $item_detail1_BeforeShow = true;  
>     $Component = & $sender;  
>     $Container = CCGetParentContainer($sender);  
>     global $item_detail1; //Compatibility  
> //Being Custom Code Manual Entry  
> //-------------------------  
> global $item_detail1;  
>  
>   $SQL = "SHOW COLUMNS FROM tici_items LIKE 'metal_ty'";  
>  
> // Open the connection  
>   $db = new clsDBConnection1();  
>   $db->query($SQL);  
>   $Result =  $db->next_record();  
>   if($Result) {  
>     $Enumfield = $db->f(1);  
>   }  
>   $db->close();  
>  
> // Parse string from DB  
>   if ($Enumfield != "") {  
>     $Enumfield =  
> str_replace("'","",substr($Enumfield,6,strlen($Enumfield)-7));  
>     $ArrayEnum = split(",",$Enumfield);  
>     foreach ($ArrayEnum as $value) {  
>        $values[] = array($value,$value);  
>     }  
>     $item_detail1->metal_ty->Values = $values;  
>   }  
>  
> }  
> //---------------------------  
> //End Custom Code Manual Entry  
> //End item_detail1_BeforeShow  
>  
> //Close item_detail1_BeforeShow @53-5EF84DA1  
>     return $item_detail1_BeforeShow;  
> //End Close item_detail1_BeforeShow  
>  
>  
> ?>  
> 
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

cdolson

Posts: 27
Posted: 06/01/2006, 1:07 PM

D'oh! That was pretty straightforward. Thanks Don!

I had renamed the DB connection from connection1 and had not updated it in the code there.

So, the error is gone now. However, I am still not managing to get the code to update my listbox with my Enum data from the metal_ty record from my item_detail table.

Any ideas on what I might be doing wrong there?
View profile  Send private message
Frosty555

Posts: 7
Posted: 06/01/2006, 1:09 PM

clsDBConnection1 is the codecharge-generated class name for your project Connection. CodeCharge puts "clsDB" before the name that you specify in the Connections flyout of your project settings.

So, you need to make certain that the connection name in the project manager is called "Connection1".

Or if you're very attached to your connection name, change the code. "clsDBConnection1" should be "clsDBTheConnectionName".

It would probably pay to make sure your record has it's connection property set too.

-- edit --

Damn too late. :-/
View profile  Send private message
cdolson

Posts: 27
Posted: 06/01/2006, 1:49 PM

Thanks Frosty. Yeah, I figured that one out with Don's help and have rid myself of that particular error.

However my listbox is still not populating itself with the "Enum" data from my DB table. Any ideas on what in the code might be preventing that?
View profile  Send private message
DonB
Posted: 06/01/2006, 7:05 PM

Can't say anything pops out at me. I like to use the var_dump($somevar) and
get_defined_vars() functions to see what's actually constructed in the cases
when I don't get the results I expect. These functions let you see what's
defined and that usually explains why the control has no data. Either data
isn't fetched, or you fetch it in the wrong event and it 'goes away' before
being output to the browser.

I normally set up SQL for a listbox in the Listbox before execute select
event of the Listbox. But you say this is taken from an example (that
presumably works), so I'm a bit surprised it doesn't work.

--
DonB

http://www.gotodon.com/ccbth


"cdolson" <cdolson@forum.codecharge> wrote in message
news:5447f52e948414@news.codecharge.com...
> Thanks Frosty. Yeah, I figured that one out with Don's help and have rid
myself
> of that particular error.
>
> However my listbox is still not populating itself with the "Enum" data
from my
> DB table. Any ideas on what in the code might be preventing that?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Benjamin Krajmalnik
Posted: 06/01/2006, 7:19 PM

For the source of your listbox, use "SQL" and place your SQL query there. I
assume you are using a list of values?
You will not need any embed code there, unless you have some need for
specific filtering or ordering, in which case you could use the
BeforeBuildSelect ot BeforeExecuteSelect embeds.


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.

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.