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()'調用來運行多個語句。 –