Jump to content
  • 0

не вижу ошибки хот убей


Avalon4eg
 Share

Question

есть запрос типа

 $sql = "UPDATE `user_data` SET `answer1`= $answ1, `answer2`= $answ2, `answer3`= $answ3 WHERE `1d` = $id";

если вывести его при помощи эха он имеет вид

UPDATE `user_data` SET `answer1`= 1 раз в месяц, `answer2`= Низкий, `answer3`= Достаточный WHERE `id` = 53

Вроде все верно, но получаю ошибку

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 'раз в месяц, `answer2`= Низкий, `answer3`= Достаточный WHERE `id` = 53' at line 1

подскажите в чем проблема?

Edited by Avalon4eg
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Проблема вот в чём:

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 'раз в месяц, `answer2`= Низкий, `answer3`= Достаточный WHERE `id` = 53' at line 1

Ну строки же надо в кавычки забирать.

  • Like 1
Link to comment
Share on other sites

  • 0

есть запрос типа

 $sql = "UPDATE `user_data` SET `answer1`= $answ1, `answer2`= $answ2, `answer3`= $answ3 WHERE `1d` = $id";

если вывести его при помощи эха он имеет вид

UPDATE `user_data` SET `answer1`= 1 раз в месяц, `answer2`= Низкий, `answer3`= Достаточный WHERE `id` = 53

Вроде все верно, но получаю ошибку

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 'раз в месяц, `answer2`= Низкий, `answer3`= Достаточный WHERE `id` = 53' at line 1

подскажите в чем проблема?

могет строковые параметры вставить в кавычки всетаки у тя там строки ))

 $sql = "UPDATE `user_data` SET `answer1`= '$answ1', `answer2`= '$answ2', `answer3`= '$answ3' WHERE `1d` = $id";

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy