This topic is locked

My PHP Code wont Work

12/23/2007 10:46:24 AM
PHPRunner General questions
S
swanside author

Hello.
I have made an invoice page, but I want to be able to display Just the VAT content of an item
This is my code for it.
SELECT ((Quantity Unit_Price) + (Quantity Unit_Price Additional_Cost / 100)) 17.5 / 100 FROM material WHERE Job_No = 1000000
This works in PHPMyAdmin, i.e. Quantity = 3, Unit_Price = 10 Additional_Cost = 20, so this will give me the price per item with an additional cost of 20%. Then it does the VAT calculation, 17.5 / 100 which comes to £6.30
When I edit my SQL in the edit sql query, I put in the following line, material is the table with the info in it;

material.((Quantity
Unit_Price +(Quantity Unit_Price Additional_Cost / 100)) 17.5 / 100,
I get this error

Cannot retrieve columns information. Please modify SQL query and try again.

Error Message:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '((Quantity
Unit_Price +Quantity Unit_Price Additional_Cost / 100)) 17.5' at line 13
Here is my code below.
1 job.Job_No,

2 job.Order_Date,

3 job.File_No,

4 job.Order_Site_Address,

5 job.Job_Description,

6 job.CustomerRef,

7 job.Invoice_Tax_Date,

8 customer.Customer_Name,

9 customer.Billing_Address,

10 labour.Working_Hrs
Paying_Rate,

11 labour.Working_Hrs Paying_Rate 17.5 / 100,

12 labour.Working_Hrs Paying_Rate + (labour.Working_Hrs Paying_Rate 17.5 / 100),

13 material.((Quantity
Unit_Price +(Quantity Unit_Price Additional_Cost / 100)) 17.5 / 100,

14 material.Quantity
Unit_Price + (Quantity Unit_Price Additional_Cost / 100),

15 material.Quantity Unit_Price + (Quantity Unit_Price Additional_Cost 17.5 / 100),

16 labour.Working_Hrs Paying_Rate + material.Quantity Unit_Price + (Quantity Unit_Price Additional_Cost / 100) 17.5 / 100,

17 labour.Working_Hrs
Paying_Rate + material.Quantity Unit_Price + (Quantity Unit_Price Additional_Cost 17.5 / 100)

18 [color="#0000FF"]from job labour

19 on (job.Job_No=labour.Job_No)

20 [color=#0000FF]inner join material

21 on (job.Job_No=material.Job_No)

22 inner join customer

23 on (job.Customer_Name=customer.Customer_Name)
Thanks

Paul.

Alexey admin 12/24/2007

Paul,
this syntax is incorrect:

material.((Quantity Unit_Price +(Quantity Unit_Price Additional_Cost / 100)) 17.5 / 100

Try using this expression:

(material.Quantity material.Unit_Price +(material.Quantity material.Unit_Price material.Additional_Cost / 100)) 17.5 / 100