Hi I have the following code that i can run in MSSQL Query and the result are returned correctly but when i try to run it in PHP it errors what do I need to change to get it to work please.

SELECT
SUM (CASE WHEN FFP.BPARTNER.CUR_0='GBP' THEN (FFP.SORDERQ.YORIQTY_0 * FFP.SORDERP.GROPRI_0) ELSE ((FFP.SORDERQ.YORIQTY_0 * FFP.SORDERP.GROPRI_0) * FFP.SORDER.CHGRAT_0) END)
FROM FFP.SORDER
INNER JOIN FFP.BPARTNER ON FFP.SORDER.BPCORD_0 = FFP.BPARTNER.BPRNUM_0
INNER JOIN FFP.SORDERP ON FFP.SORDER.SOHNUM_0 = FFP.SORDERP.SOHNUM_0
INNER JOIN FFP.SORDERQ ON FFP.SORDER.SOHNUM_0 = FFP.SORDERQ.SOHNUM_0
WHERE FFP.SORDER.YFPSODAT_0=DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) and FFP.SORDER.SOHTYP_0!='SO6' and FFP.SORDER.YFPSOSO_0=2 and FFP.BPARTNER.CUR_0='GBP'

What's the error?

Sorry rookie mistake I had the wrong quotes around the query.