MySQL Syntax Error in PHP Script -


i have query in mysql works fine, when copy query on php file, throwing me syntax error: ** unexpected ") week_ending ** missing?

mysql:

'select count(*) count,region, date_format(now(),'%d %b %y') week_ending stores.stats date > date_add(date(now()), interval -1 week) , date < date(now()) group region, date(now())';

php:

$stmt = db::query(database::select, 'select count(*) count,region, date_format(now(),'%d %b %y'), week_ending stores.stats date > date_add(date(now()), interval -1 week) , date < date(now()) group region, date(now())';

there couple single quotes in middle of sql prematurely terminating request. need escape quotes near here:

date_format(now(),'%d %b %y'), 

like this:

date_format(now(),\'%d %b %y\'), 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -