Title: SQL Error after Migration to new server
Last modified: August 21, 2016

---

# SQL Error after Migration to new server

 *  Resolved [newtonwp](https://wordpress.org/support/users/newtonwp/)
 * (@newtonwp)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/sql-error-after-migration-to-new-server/)
 * After moving our website to a new server, CSS Javascript Toolbox stopped working.
   I tracked it down to an error being thrown in the PHP Error Logs. The PHP version
   is 5.3.2-1ubuntu4.19.
 * The error is:
    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 ‘; /* for query SELECT blocks.id,blocks.name,blocks.pinPoint,
   blocks.code,blocks.location,blocks.links,blocks.expressions,(blocks.pinPoint &
   50331648) blocksGroup FROM `wp_cjtoolbox_blocks` blocks\n\t\t\t\t\t\t\t\t\t\t\
   tLEFT JOIN `wp_cjtoolbox_block_pins` pins\n\t\t\t\t\t\t\t\t\t\t\tON blocks.`id`
   = pins.`blockId` WHERE (((`backupId` IS NULL) AND (blocks.`code` != ”) AND (`
   state` = ‘active’)) AND \n\t\t\t\t\t\t\t\t\t\t\t((blocks.`pinPoint` & 50331648)));;/*
   From [/wp-content/plugins/css-javascript-toolbox/framework/db/mysql/queue-driver.
   inc.php:330] */ made by require(‘wp-blog-header.php’), wp, WP->main, do_action_ref_array,
   call_user_func_array, CJTBlocksCouplingController->initCoupling, CJTBlocksCouplingController-
   >getBlocks, CJTCouplingModel->getPinsBlocks, CJTPinsBlockSQLView->exec, CJTMYSQLQueueDriver-
   >select
 * Based on the error, I found the extra semicolon was causing the problem. So, 
   I added the following line:
 *     ```
       queue-driver.inc.php:329 - 332
       		if ($query && empty($resultSet)) {
       			$query = str_replace(';;',';',$query);
       			$resultSet = $this->wpdb->get_results($query, $returnType);
       		}
       ```
   
 * That seems to stop the error.
 * Any suggestions or is this the proper bug fix?
 * The plugin is still not loading the code blocks when visiting the website, still
   trying to figure out why.
 * [http://wordpress.org/extend/plugins/css-javascript-toolbox/](http://wordpress.org/extend/plugins/css-javascript-toolbox/)

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

 *  Thread Starter [newtonwp](https://wordpress.org/support/users/newtonwp/)
 * (@newtonwp)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/sql-error-after-migration-to-new-server/#post-3751781)
 * I was not able to figure out why it was not loading the code blocks. When running
   the sql query, it found the code blocks, but they were not being output to the
   html when viewing the page.
 * I had to ultimately disable the plugin and migrate my code blocks to the “Specific
   Files” plugin which worked perfectly.
 * I really liked CSS & Javascript Toolbox, but unfortunately it’s not working for
   any of the WP sites I’ve migrated to our new server.
 * Any insight would be great.
 *  Plugin Author [wipeoutmedia](https://wordpress.org/support/users/wipeoutmedia/)
 * (@wipeoutmedia)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/sql-error-after-migration-to-new-server/#post-3751871)
 * Hello,
 * Thanks for reporting!
 * I’ll check it out and let you know what caused this issue.
 * Regards,
    Ahmed
 *  Plugin Author [wipeoutmedia](https://wordpress.org/support/users/wipeoutmedia/)
 * (@wipeoutmedia)
 * [13 years ago](https://wordpress.org/support/topic/sql-error-after-migration-to-new-server/#post-3752189)
 * Hello,
 * Thanks for your informative message. Also please accept my apologize as we were
   busy working on the next release.
 * You’ve just did a great job for replacing ;; with a ;! The query you submit is
   a valid query and worked with me too however there’re another query you didn’t
   know about and its responsible for retrieving other code blocks.
 * I’ll describe the method of querying the code blocks by the CJT plugin.
 * There’re two queries to be done for the code blocks to be retrieved:
 * 1. Querying blocks associated with the current WordPress request object (page,
   post, custom post, category, ALL PAGES, ALL POSTS, etc…) as selected from the
   block assignment panel. CJT will used any block returned with this query.
 * 2. Select all blocks that has ‘link’ or ‘expression’ added from the block assignment
   panel advanced tab. CJT will try to check if any of the returned blocks (links
   and expressions) is matching the current request URI. So this query might has
   a result however non of those has a matched link or expression to associated 
   with the current request!!
 * Procedures:
 * – Please make sure that you’ve at least single code block that assigned to a 
   the requested page by checking the block assignment panel/
    – Please also check
   if the block is activate. – Also CJT won’t use any empty code blocks. – Are you
   sure that the database posts (pages, posts, categories, etc…) still has the same
   ids after you migrate the servers? CJT use posts/pages/categories ids for associating
   the block with them (see cjtoolbox_block_pins table)! If you felt that the ids
   might changed please deselect any assignment panel selected object, save block,
   select it again and save it again. – you can add the following lines (for debugging)
   in tables/pins-blocks-view.php file @ line 79 you’ll see both queries when loading
   a page.
 * `echo "{$query}<br>";`
 * I know I might be overloading you with many procedures however I cannot see the
   issue and I’m just trying to imagine, also we’ve no similar issue reported! So
   please as you can to let me know what happened. Please start with the sample 
   procedures like creating new block, assign it to a page/post, save the block 
   and click on that page from the assignment panel.
 * Hope that helps.
 * Waiting your response!
 * Regards,
    Ahmed

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

The topic ‘SQL Error after Migration to new server’ is closed to new replies.

 * ![](https://ps.w.org/css-javascript-toolbox/assets/icon-256x256.gif?rev=3132209)
 * [CSS & JavaScript Toolbox](https://wordpress.org/plugins/css-javascript-toolbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/css-javascript-toolbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/css-javascript-toolbox/)
 * [Active Topics](https://wordpress.org/support/plugin/css-javascript-toolbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/css-javascript-toolbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/css-javascript-toolbox/reviews/)

## Tags

 * [sql-error](https://wordpress.org/support/topic-tag/sql-error/)

 * 3 replies
 * 2 participants
 * Last reply from: [wipeoutmedia](https://wordpress.org/support/users/wipeoutmedia/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/sql-error-after-migration-to-new-server/#post-3752189)
 * Status: resolved