title: mysql query error in PHP but working in phpmyadmin
body: <p>I have write a query in mysql and it is running in phpmyadmin, but in PHP it giving me error</p>
  
  <blockquote>
    <p>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 'select docno, docdate, doctype, narration, drcr, (case when drcr = 'Dr' then amo' at line 2</p>
  </blockquote>
  
  <p>My Query is in PHP is :</p>
  
  <pre><code>$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 &lt; 0 then ' Cr' else ' Dr' end) ) as balance from (select docno,  
  docdate, doctype, narration, amount, drcr from ledger where accode = 1 )as q1";
  </code></pre>
  
  <p>what is wrong here with php?</p>