What is wrong with this MySQL statement?

$my->query("UPDATE ideas SET category = 'Document Options', category_id = '4', status = 'Released', status_id = '3', title = 'Support for iPad', idea = 'Add support for iPad. Allow uploads and downloads via the anonymous App for iPhone and iPad.', release = '0', release_date = '' WHERE id = '225'"); 

$my is a custom class that contains many other mysql commands. To prove that it works fine, it works great for the following query:

 $my->query("UPDATE idea_feedback SET Feedback = '$feedback', Date = '$fdate' WHERE ID = '$i'"); 
+4
source share
1 answer

Release is the key word, backtick it

 $my->query("UPDATE ideas SET category='Document Options', category_id='4', status='Released', status_id='3', title='Support for iPad', idea='Add support for iPad. Allow uploads and downloads via the anonymous App for iPhone and iPad.', `release`='0', release_date='' WHERE id='225'"); 

Notes:

  • release_date = '' set it to an invalid date token 0000-00-00 '
  • do not quote numbers even if MySQL allows you
+4
source

Source: https://habr.com/ru/post/1345293/


All Articles