0
工作,我必须写在MySQL查询,它是在phpMyAdmin运行,但在PHP它给我的错误MySQL查询错误,但在phpMyAdmin
您的SQL语法错误;检查对应于你的MySQL服务器版本使用附近的正确语法手册“选择docno,docdate,文档类型,叙事,DRCR,(情况下,当DRCR =‘博士’,然后AMO”第2行
我查询是PHP是:
$sql = "set @runtot := 0; select docno, docdate, doctype, narration, drcr, (case when drcr = 'Dr'
then amount else 0 end) as debit, (case when drcr = 'Cr' then amount else 0 end) as
credit, concat(abs((@runtot := @runtot + (case when drcr = 'Dr' then amount else amount*-1
end))), (case when @runtot < 0 then ' Cr' else ' Dr' end)) as balance from (select docno,
docdate, doctype, narration, amount, drcr from ledger where accode = 1)as q1";
什么是PHP的错在这里
你使用的是mysql_query吗? –
是的代码是mysql_query($ sql); –
您不能使用一个'mysql_query()'调用来运行多个语句。 –