解析此解析语法错误,以便生成我的查询[关闭]

im trying to run this query below but im getting this error

Parse error: syntax error, unexpected '%' in C:\xampp\htdocs\how are things\admin panel\daily.php on line 79

the code online 79 is this

   $result = "SELECT DATE_FORMAT(start_date, "%m-%d") AS 'month and day',balance as amount FROM `aggrement`";

when i run this query on my phpmyadmin its running successfully but when i put it on my php page im getting this error above i tied to remove the double quotes(i.e these "") and replace it with the single quotes(i.e these `) ,im getting this noticeUnknown column '%m-%d' in 'field list'`

try like this-

 $result = "SELECT DATE_FORMAT(start_date, '%m-%d') AS 'month and day',balance as amount FROM `aggrement`";

You need to escape your quotes, for example:

"SELECT DATE_FORMAT(start_date, \"%m-%d\") AS ..."

Use single quotes. (') Or, if you want double quotes, don't forget to escape them when your PHP string is delimited by double quotes.

With double quotes:

 $result = "SELECT DATE_FORMAT(start_date, \"%m-%d\") AS 'month and day',balance as amount FROM `aggrement`";

Backticks don't work as they quote field names, not strings.