Title: Fix for SQL syntax error
Last modified: January 8, 2017

---

# Fix for SQL syntax error

 *  [Armin Rosu](https://wordpress.org/support/users/armin_san/)
 * (@armin_san)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/fix-for-sql-syntax-error/)
 * If you are getting this error:
 * `WordPress database error 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'
   s nine o'clock" src="...`
 * That is because you have an attribute other than `src` following `img`. E.g.:`
   <img alt="Something" src="http://logo.gif" />`
 * To fix this, change _wp-content/plugins/auto-post-thumbnail/auto-post-thumbnail.
   php_ line 291 to `foreach ($matches[1] as $key => $image) {`
 * and remove or comment out line 303: `// $image = substr($image, strpos($image,'"')
   +1);`
 * The bug is caused by 2 issues:
 * * not looking for the `src` tag but the first tag after `<img`
    * not sanitizing
   the SQL query for `'`

The topic ‘Fix for SQL syntax error’ is closed to new replies.

 * ![](https://ps.w.org/auto-post-thumbnail/assets/icon-256x256.gif?rev=3469511)
 * [Auto Featured Image (Auto Post Thumbnail)](https://wordpress.org/plugins/auto-post-thumbnail/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/auto-post-thumbnail/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/auto-post-thumbnail/)
 * [Active Topics](https://wordpress.org/support/plugin/auto-post-thumbnail/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/auto-post-thumbnail/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/auto-post-thumbnail/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Armin Rosu](https://wordpress.org/support/users/armin_san/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/fix-for-sql-syntax-error/)
 * Status: not a support question