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

 Master/Detail Form Problem

Print topic Send  topic

Author Message
andywks

Posts: 2
Posted: 12/06/2008, 10:52 PM

Dear all, help please. I research CCS for about a month but not yet have the solution yet.

I would like to build master and detail form in 1 page.

Table structure as following:

Master table (ORDER_HEAD)

ORDER_ID
ORDER_DATE
TOTAL_PRICE

Detail table (ORDER_TAIL)

ORDER_ID
LINE_NO
ITEM_DESCRIPTION
PRICE

Just a very simple example here.
I would like to let my user to only key in value for the detail table.
There is no need to show them the Master table as all the value will be control by server side.
What I need to do so when user click on the add button at the detail grid, the system will add 1 row at the master table and then pass the ORDER_ID to the detail grid and process the insert?
Please advise for the solution. Thank you.
View profile  Send private message
jacem

Posts: 87
Posted: 12/09/2008, 4:24 PM

In the code for the 'add' button event trigger you might consider doing some sql:

$db = new clsDBMyDatabaseDB();
$SQL = "INSERT INTO master (Name, address,creationdate) "
."VALUES (".$master->Name->Value .",'".$master->Address->Value ."','"
."curdate())";
$db->query($SQL);
echo mysql_error();

//then you can retrive the most recent added ID or search for the ID of the record you added by searching on the field content you added. Again you just need to work out your sql and execute it as above: $db->query($SQL); you can then set the added master id into your detail record so the master detail link is established.

//don't forget to close the sql db
$db->close();
Hope this helps.
View profile  Send private message
andywks

Posts: 2
Posted: 12/10/2008, 8:24 PM

Thank you. I think I know what to do.
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.

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.