Time : 08:46:40 SQLSTATE[42000]: Syntax error or access violation: 1064 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 '' at line 1 Raw SQL : select ipaddress from p_customers where customerid= Time : 08:09:55 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'p.PARTY' in 'where clause' Raw SQL : select count(DISPATCHREGISTERID) as totalnew_parties from dispatchregister as ab,partydetail as p,(select PARTY as prty,CITY from contact) as c where p.PARTYID=ab.FIRMNAME and p.PARTY=c.prty and DISPATCHREGISTERID=10 order by DISPATCHDATE DESC