Title: PHP / MySQL Error
Last modified: August 20, 2016

---

# PHP / MySQL Error

 *  [rrhobbs](https://wordpress.org/support/users/rrhobbs/)
 * (@rrhobbs)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/php-mysql-error/)
 * The following error appears in my php error log each day recently:
 * [05-Dec-2012 06:22:08 UTC] 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 ‘status timestamp <= 1260080528 and id not in (select
   redirect_id from truncated-table-prefix’ at line 1 for query select id from table-
   prefix_wbz404_redirects where status = 2 status timestamp <= 1260080528 and id
   not in (select redirect_id from table-prefix_wbz404_logs) made by do_action_ref_array,
   call_user_func_array, wbz404_cleaningCron
 * ???
 * thanks
 * [http://wordpress.org/extend/plugins/404-redirected/](http://wordpress.org/extend/plugins/404-redirected/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [kokopelli](https://wordpress.org/support/users/kokopelli/)
 * (@kokopelli)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243457)
 * Me too. Any update on this, or a fix?
 * Thanks
 *  [edrandall](https://wordpress.org/support/users/edrandall/)
 * (@edrandall)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243459)
 * Me too, just noticed this in my error_log, once every day.
 * The error is the SQL lines 401-405 of “404-redirected/includes/functions.php”,
   reads:
 *     ```
       401) //Find unused urls
       402) $query = "select id from " . $wpdb->prefix . "wbz404_redirects where status = " . $wpdb->escape(WBZ404_AUTO) . " status ";
       403) $query .= "timestamp <= " . $wpdb->escape($then) . " and id not in (";
       404) $query .= "select redirect_id from " . $wpdb->prefix . "wbz404_logs";
       405) $query .= ")";
       ```
   
 * that line 402 should read:
 *     ```
       $query = "select id from " . $wpdb->prefix . "wbz404_redirects where status = " . $wpdb->escape(WBZ404_AUTO) . " AND ";
       ```
   
 *  Thread Starter [rrhobbs](https://wordpress.org/support/users/rrhobbs/)
 * (@rrhobbs)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243460)
 * I have upgraded to WP 3.5 still get the error(s)
 *  [edrandall](https://wordpress.org/support/users/edrandall/)
 * (@edrandall)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243461)
 * It’s the 404-redirected plugin, we’re running v.1.3.2 which is the latest I think.
   I just hacked that fix in to the installed copy of the file myself 😉
 *  Thread Starter [rrhobbs](https://wordpress.org/support/users/rrhobbs/)
 * (@rrhobbs)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243462)
 * edrandall: implemented your fix – thx. didnt throw an error 🙂
 * 😉
 * will keep an eye on php logs and report back if problems.
 * thx 🙂
 *  [kokopelli](https://wordpress.org/support/users/kokopelli/)
 * (@kokopelli)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243463)
 * Thanks, I’ll give it a try. 🙂
 * BTW, I found the line to be changed on line 331 of my functions.php file (Version:
   1.2 of the plugin).
 *  [edrandall](https://wordpress.org/support/users/edrandall/)
 * (@edrandall)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243468)
 * Seems to be working, nothing at all in my error_log for 2 days.
 *  [kokopelli](https://wordpress.org/support/users/kokopelli/)
 * (@kokopelli)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243469)
 * The “fix” does seem to prevent errors, but it also removes the 404 Redirected
   > TOOLS sub-menu in the backend. Any ideas?
 * Thanks
 * Edit: I just realized I still had V1.2 installed, therefore the mention above
   to editing different line numbers. If you apply the suggested fix to V1.3.2, 
   the TOOLS menu doesn’t disappear.
 *  [Marcelo Pedra](https://wordpress.org/support/users/kent-brockman/)
 * (@kent-brockman)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243474)
 * I had the same issue. This fix looks like solved the situation. I will check 
   my error logs in the next days to see if this is finally solved. I’ll be back
   here if errors come back.
    Thank you [@edrandall](https://wordpress.org/support/users/edrandall/)
   🙂

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘PHP / MySQL Error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/404-redirected.svg)
 * [Redirectioner](https://wordpress.org/plugins/404-redirected/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/404-redirected/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/404-redirected/)
 * [Active Topics](https://wordpress.org/support/plugin/404-redirected/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/404-redirected/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/404-redirected/reviews/)

## Tags

 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 9 replies
 * 4 participants
 * Last reply from: [Marcelo Pedra](https://wordpress.org/support/users/kent-brockman/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/php-mysql-error/#post-3243474)
 * Status: not resolved