CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Use data in a record screen to update another table.

Print topic Send  topic

Author Message
bigtoe

Posts: 115
Posted: 12/30/2004, 1:27 PM

I have 2 database tables:
  
create table T_bricks (  
  F_brick                            CHAR(10) NOT NULL,  
  PRIMARY KEY                       (F_brick),  
  F_brick_color                      CHAR(10),  
  F_brick_length                     CHAR(10),  
  F_brick_width                      CHAR(10),  
  F_brick_supplier                   CHAR(20),  
  F_brick_description                CHAR(50)  
);  
  
create table T_walls (  
  F_wall                             CHAR(10) NOT NULL,  
  PRIMARY KEY                       (F_wall),  
  F_wall_brick_color                 CHAR(10),  
  F_wall_brick_length                CHAR(10),  
  F_wall_brick_width                 CHAR(10),  
  F_wall_supervisor                  CHAR(20),  
  F_wall_location                    CHAR(50)  
);  
Assuming that:
The primary keys in both tables are auto generated and auto incremented.
The T_bricks table has 50 rows of data.
The user is looking at the record screen for T_bricks.
(This record screen was invoked by another grid screen.)
This record screen does not allow editing. All fields are labels.

I would like to put a Link on this T_bricks record screen. The text on
the Link will be "Create a Wall this type of Brick"

When the user clicks on this Link:
1. Get the data from the labels F_brick_color, F_brick_length and F_brick_width.
2. Insert a new row in the table T_walls using the data
F_brick_color    for F_wall_brick_color   
F_brick_length   for F_wall_brick_length  
F_brick_width    for F_wall_brick_width
3. Leave the rest of the fields blank for this row in T_walls.
4. Get the primary key for this new row in T_walls.
5. Pass this primary key as a parameter to the "edit_wall.php" page.

How can I do steps 1 thru 5 in CCS?





View profile  Send private message
peterr


Posts: 5971
Posted: 12/30/2004, 3:45 PM

You probably cannot retrieve label values (#1) because Web browsers don't submit such values. However this should not be needed since you can read that data from the database anyway.
Without creating your application I can recommend:
For #1: the example at http://docs.codecharge.com/studio/html/ProgrammingTechn...leDBValues.html
For #2: the example at http://docs.codecharge.com/studio/html/ProgrammingTechn...eCustomSQL.html
For #4-$5: either of the above examples (use the appropriate database function with an SQL), or "Multi-Step User Registration" in CCS Example Pack, which also retrieves the last inserted key and passes it to the next page: http://examples.codecharge.com/ExamplePack/MultiStepReg...gistration1.php

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
bigtoe

Posts: 115
Posted: 12/31/2004, 4:24 AM

Hi peterr

Thanks for your suggestions.

I followed your 2nd suggestion as shown in
http://docs.codecharge.com/studio/html/ProgrammingTechn...eCustomSQL.html


I added the following "Custom Code" under "After Execute Update" for the Record:


$db = new clsDBConnection1();
$SQL = "INSERT INTO ...";
$db->query($SQL);
$db->close();


(the INSERT INTO ... is snipped here but it works fine in mysql)


But when I click the Submit button on this page, I see
Fatal error: Cannot instantiate non-existent class: clsdbconnection1 in /var/www/html/t_bricks_edit_events.php on line 134

Where line 134 is
$db = new clsDBConnection1();


What did I do wrong?

View profile  Send private message
peterr


Posts: 5971
Posted: 12/31/2004, 12:28 PM

You would need to replace "Connection1" with the name of your database connection that you created in CCS.
I hope that't the problem as sometimes I could miss something too.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
bigtoe

Posts: 115
Posted: 12/31/2004, 2:13 PM

Yeah, I replaced

$db = new clsDBConnection1();

with

$db = new d1_connection();

where d1_connection is the name of my connection when I
originally did the Application Builder.

But that did not work either.

I still get the message:
"Fatal error: Cannot instantiate non-existent class ...."
at the same line number.




View profile  Send private message
peterr


Posts: 5971
Posted: 12/31/2004, 5:00 PM

You shouldn't replace or remove "clsDB", only replace "Connection1".
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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