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

 Insert in one table, update another

Print topic Send  topic

Author Message
mysticmoose04

Posts: 1
Posted: 11/11/2008, 6:23 AM

I'm redoing my inventory database with code charge and I've hit a road block. Here is what I want to do. I'm filling out a 'Purchase Order' form which asks for how many units you bought, date, and other misc info. What I want to do in code charge is when I put in that I bought 5 wingnuts, it adds +5 to my wingnut quantity count. I will note, there is an assumption that 'wingnuts' already exists. I am not trying to do anything really fancy.

I have the form all working, except the automatic inventory addition.

Here is the table diagram, they are related by the pro_id field.
[PurchaseOrder]
pur_ord_id
pur_ord_date
pur_qty_ordered
pur_total_cost
pro_id

[Product]
pro_id
pro_name
pro_qty

In my original php files.. I have it working by doing two separate sql commands. One command inserts the purchase order information while the other updates my product inventory count. Something along these lines: update product '$_post[pur_qty_ordered]' + [pro_qty]' etc etc. But I can't use that code with codecharge.

Any help would be appreciated,
Aaron
View profile  Send private message
philipeph

Posts: 1
Posted: 12/03/2008, 8:05 PM

Hello,

You can also use ON-UPDATE and/or ON-INSERT database triggers on the database level so you don't have to do it your front-end code.

Philip E.
View profile  Send private message
maxhugen

Posts: 272
Posted: 12/04/2008, 7:04 PM

If you cannot use Triggers (typically in hosted databases), you can use the AfterInsert, AfterUpdate and AfterDelete events to do the updating on your product table.
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.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.