swanside Posted November 7, 2007 Share Posted November 7, 2007 Hello all, I have a MySQL database and have made several search and results pages with Dreamweaver, but I am stuck with a problem. I have a table called materials, In this table I have the following fields, Title (A description of a location where the item is for), Job_No (A filed that is common through out the database and a material item is attached to the Job_No), Quantity (SPeaks for itself, but is the amount of items used), Unit_Price (A cost per item), Additional_Cost (Is the selling cost per item as a percentage i.e. 20% 10% and so on). In Dreamweaver, I have created a recordset from the table required (material) and if I go to the advanced setting I cna enter the following, SELECT Quantity * Unit_Price FROM `material` WHERE Job_No = 'colname' This then gives me the total of the materials used against a selected Job_No and displays it into a dynamic Table. The problem comes when I want to automatically add the percentage from the Additional_Cost. If I go into the database using MyPHPAdmin and enter, SELECT Quantity*Unit_Price+(Quantity*Unit_Price*Additional_Cost/100) FROM `material` WHERE Job_No = 1000980, it works, and I get the main total, but, if I put this code into dreamweaver, SELECT Quantity*Unit_Price+(Quantity*Unit_Price*Additional_Cost/100) FROM `material` WHERE Job_No = 'colname' Or SELECT Quantity*Unit_Price+(Additional_Cost%) FROM `material` WHERE Job_No = 'colname' it wont work. My space in the Dynamic Table is blank? Can anybody please help? Cheers Paul. Quote Link to comment Share on other sites More sharing options...
Barand Posted November 7, 2007 Share Posted November 7, 2007 Have you tried assigning an alias to the calculation SELECT Quantity*Unit_Price+(Quantity*Unit_Price*Additional_Cost/100) as totalcost FROM `material` WHERE Job_No = 'colname' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.