[thelist] Calculating values from field types (PHP + MySQL)

Dave Stevens stem at stemofficial.co.uk
Wed Aug 21 18:10:01 CDT 2002


--
[ Picked text/plain from multipart/alternative ]
Greetings evolters,

Sorry about the vague title, I'll try and explain better here.

I've hit another problem in my latest project (you'll have noticed the previous two questions, sorry!)

Here's the trouble:

I need to calculate the shipping costs for different items in my store. These are calculated as follows:

A base rate of £1.50 stands for all orders. Each item that is added either has £1.00 added on if the type is type "a" or £0.50 if the type is type "b".

Each product in my products table in the database has a Type defined in a field called "type".

 What I have been trying to do is, using php, pull all the "type" fields from the products table for all the selected products in the user's basket, and then use an if statement to say "If the type is 'a', add £1.00 and if the type is 'b', add £0.50" however it has not been going to plan, the shipping always is just the base rate + any type 'a' products.

Is there a better way to do it other than using an if statement? Or is there just a better way to use an if statement?

Thanks for your ongoing help,
Dave Stevens
--




More information about the thelist mailing list