2
I have a problem with an SQL that runs perfectly in phpMyAdmin, but does not run the query to the database by PHP.
Query copied from phpMyAdmin’s SQL field:
SELECT `idforma_pagamento`, `habilitado`, `descricao`,
CASE forma_pagamento.tipo
WHEN 0
THEN 'A PRASO'
WHEN 1
THEN 'A VISTA'
END AS tipo,
CASE forma_pagamento.entrada
WHEN 0
THEN 'SIM'
WHEN 1
THEN 'NÃO'
END AS entrada
FROM forma_pagamento
WHERE 1
Same query passed to variable $query
in PHP:
"SELECT `idforma_pagamento`, `habilitado`, `descricao`,"
."CASE forma_pagamento.tipo"
."WHEN 0"
."THEN 'A PRASO'"
."WHEN 1"
."THEN 'A VISTA'"
."END AS tipo,"
."CASE forma_pagamento.entrada"
."WHEN 0"
."THEN 'SIM'"
."WHEN 1"
."THEN 'NÃO'"
."END AS entrada"
."FROM forma_pagamento"
."WHERE 1";
Someone there can help me
You’re missing spaces for the other lines, otherwise it’s all stuck together
CASE forma_pagamento.tipoWHEN 0
just as it is.– Jorge B.
Term detail instead of PRASO ;)
– Silvio Andorinha