Here is such a mistake:

Error Number: 1064

You have an error in your SQL syntax; Check out the manual for the right syntax to use near 'Ataman' (pork, tomato, onion, cheese, chesn, mas) '' at line

SELECT * FROM `db_price` WHERE `name`='Мясо 'Атаман' (свинина, помидор, лук, сыр, чесн, м-з)' AND `date`='20' 

Filename: /bhome/part2/01/dchem/domobed.ru/www/admin/controllers/admin.php Line Number: 464

Request such:

 "SELECT * FROM `db_price` WHERE `name`='".$names."' AND `date`='".$day."'" 

Help solve.

Reported as a duplicate by Ipatiev php Jan 6 at 8:14 am

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • one
    Here it is not necessary to decide, see Ataman is highlighted, this is a mistake! Remove quotes near this word! ZY time to go to the editors with syntax highlighting! - Palmervan 2:32 pm
  • Quotes are not necessary to remove, if I remove them, then my following requests will not be executed. - blud
  • one
    Well, do not remove ... what I need ... syntax to use near 'Атаман' speaks for itself! - Palmervan
  • 2
    Vegetable soup with chicken meatballs - you need to quote - zhenyab
  • 2
    Try reading [manual] [1]. [1]: ru.php.net/mysql_real_escape_string - razielsd


2 answers 2

 "SELECT * FROM `db_price` WHERE `name`='".mysql_real_escape_string($names)."' AND `date`='".mysql_real_escape_string($day)."'" 

    you have single quotes in the query in the name of the sausage, and they are a special SQL character

    To insert such use scheme \ '

    example: SELECT * FROM `db_price` WHERE` name` = 'Meat \' Ataman \ '(pork, tomato, onion, cheese, chesn, mas)' AND `date` = '20 '

    mysql_real_escape_string will do it for you

    • Sorry, how does your solution differ from the one already proposed? - 0xdb