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

 Write or Insert Data to Two Tables

Print topic Send  topic

Author Message
DataDoIt
Posted: 02/24/2004, 6:05 PM

PHP4; MySQL; CCS2

I know it's likely been discussed before, but my initial search didn't find
anything....

If I have a record grid, and click Submit or Add, I want to write some
information from that grid to another table also.

Table 1 that the record grid is built on:

ApplicationID
FamilyCode
FirstName
LastName

Table 2 that I'd like to also write data to when Table 1 is updated:

ApplicationID
FamilyCode
AutoNumber

Must be able to either update an existing record, or add a new record to
Table 2 (based on Submit or Add in Table 1). How can this be done, or point
in the right direction. Thanks.

-Mike

Martin
Posted: 02/24/2004, 11:59 PM

Hello.
Sorry about my english.
You must have a look in the ccs help (F1).
Examples and technics, programming, database.
If you would like to insert or update in a second table you must enter code in after insert or after update from your form like this.

$SQL = "INSERT INTO Table2 (ApplicationID,FamilyCode,AutoNumber) ".
"VALUES (". CCToSQL(CCGetParam("ApplicationID",0),ccsInteger) .",". CCToSQL(CCGetParam("FamilyCode"),ccsInteger) ."," . CCToSQL(CCGetParam("AutoNumber"),ccsInteger))";

$db = new clsDBYourConnectionName();
$db->query($SQL);
unset($db);

By,
Martin
DonB
Posted: 02/25/2004, 7:05 PM

You don't need to declare a new connection. You can just write:

Global $dbYourConnectionName
$dbYourConnectionName->query($SQL); (using the existing connection).

(hope I got the syntax right)
--
DonB

http://www.gotodon.com/ccbth


"Martin" <Martin@forum.codecharge> wrote in message
news:5403c55e7234be@news.codecharge.com...
> Hello.
> Sorry about my english.
> You must have a look in the ccs help (F1).
> Examples and technics, programming, database.
> If you would like to insert or update in a second table you must enter
code in after insert or after update from your form like this.
>
> $SQL = "INSERT INTO Table2 (ApplicationID,FamilyCode,AutoNumber) ".
> "VALUES (". CCToSQL(CCGetParam("ApplicationID",0),ccsInteger)
..",". CCToSQL(CCGetParam("FamilyCode"),ccsInteger) ."," .
CCToSQL(CCGetParam("AutoNumber"),ccsInteger))";
>
> $db = new clsDBYourConnectionName();
> $db->query($SQL);
> unset($db);
>
> By,
> Martin
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


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.

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.