Title: Mysql syntax error..
Last modified: January 12, 2018

---

# Mysql syntax error..

 *  Resolved [jeffreylebowski](https://wordpress.org/support/users/jeffreylebowski/)
 * (@jeffreylebowski)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/mysql-syntax-error-2/)
 * Running a sql script via Cron Scheduler and I get this error in the log file:
 *  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‘
   SET [@newid](https://wordpress.org/support/users/newid/) = last_insert_id()………….
 * This is what is in the sql script right after an Insert statement:
 * SET [@newid](https://wordpress.org/support/users/newid/) = last_insert_id();
 * Any thoughts?

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

 *  [alichani](https://wordpress.org/support/users/alichani/)
 * (@alichani)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/mysql-syntax-error-2/#post-9856659)
 * Hi [@jeffreylebowski](https://wordpress.org/support/users/jeffreylebowski/),
   
   check the line that comes before the `SET @newid`?
 *  [Subrata Sarkar](https://wordpress.org/support/users/subrataemfluence/)
 * (@subrataemfluence)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/mysql-syntax-error-2/#post-9857440)
 * Not sure, but are you trying to execute multiple queries at one go? Most probably
   MySql does not support this!
    -  This reply was modified 8 years, 4 months ago by [Subrata Sarkar](https://wordpress.org/support/users/subrataemfluence/).
 *  Thread Starter [jeffreylebowski](https://wordpress.org/support/users/jeffreylebowski/)
 * (@jeffreylebowski)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/mysql-syntax-error-2/#post-9858961)
 * [@alichani](https://wordpress.org/support/users/alichani/) – added single quotes
   to the table on the previous line.. all good now. Thanks.

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

The topic ‘Mysql syntax error..’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [jeffreylebowski](https://wordpress.org/support/users/jeffreylebowski/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/mysql-syntax-error-2/#post-9858961)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
