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

 Form Grid - 'Ordering' multiple Items with a quantity?

Print topic Send  topic

Author Message
Reddog
Posted: 05/05/2005, 5:44 AM

Hi all,
I have just started looking at CC and I am try to work out how to do the following., I am using PHP and mysql.

I have added a form grid to a page, choosen my 'Items' table and display description, price etc. I have added a Quanity select control (with 0,1,2,3,4...) for each item. I have added a 'submit' button.

What is the best way in CC to 'walk around' the items once submitted, and check if there is an Item quantity set and then place a record into an Order table?

I do not want a 'one line at a time shopping cart' .

If there is an example someone can point me too that would be great.
peterr


Posts: 5971
Posted: 05/05/2005, 12:51 PM

You can use any SQL that your database supports.
The code example is in the events of the "ShoppingCart" page of the "Store" example. The code there is meant to work with all databases, therefore records are copied one-by-one, but if your database supports more complex SQL that can copy multiple records at once then use it. You can probably do this without any knowledge of CCS if you write your SQL statement properly.
For MySQL try this:
http://www.google.com/search?hl=en&lr=&q=mysql+copy+records+multiple+tables
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
reddog
Posted: 05/10/2005, 6:46 AM

Thanks peterr but my question is not about SQL.

This issue is 'how do I walk the form variables once I click the form button.'

I want to find out the Quantity the user has selected for each item (row).

I was hoping that I can get CC to reply with an array (PHP) that contains the row variable names and their values.

Any idea??
Nicole

Posts: 586
Posted: 05/11/2005, 2:35 AM

Hello,
It’s interesting idea... I think you can use CCS Editable Grid form with a single input control – quantity in each row. Try the following approach, however I haven’t implemented it on a real form I think it should work.
To insert new record into Order table for each row where quantity is not 0 you can use Custom Update of SQL type. In this case set Allow Insert and Allow Delete properties of a form to No because they are useless. In Custom Update put SQL query that inserts records, like
Insert into Order_table (quantity_field) values ({quantity})
The next step is to omit records where quantity is 0. Create Before Execute Update event where check quantity control value. If it is empty or 0 forbid SQL execution for this row
$form_name->ds-> CmdExecution = false;
Hope it helps :-)

_________________
Regards,
Nicole
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.