How to Fix Error "1064 You have an error in your SQL syntax"

Did you bump into the error "1064 You have an error in your SQL syntax"? The full text of the error will be:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 4

You are trying to use your "Shack User Switching" Joomla extension to log into your Joomla site front-end as one of your Joomla users. But instead of seeing the front-end of your site as this user, you see a screen with the error.

Depending on how your server deals with PHP and SQL errors, your error message might not display the "1064" number:

the 1064 sql error

Here is a screenshot with the error message text containing the "1064" number:

the error with the 1064 number

Here is how to fix this error:

  • In your Joomla administrator panel, go to "Users" > "Manage":

click users manage

  • This will bring you to the "Users" screen, as you can see on the next image. Under the "ID" column, find the ID number of the superuser to whom you would like to allow to log in to your Joomla front-end as other users. Copy this number. For my example, the ID number of the superuser will be 792:

find the id number of the superuser

  • Go to "Extensions" > "Plugins":

go to extensions plugin

  • You will see the "Plugins" screen, as shown on the next image. Find the "Authentication - Shack User Switching" plugin and click on its name:

click authentication shack user switching

  • Enter the ID number of the superuser you copied a few moments ago in the "Allow only these Users IDs to switch users":

enter the id number of the superuser in the allow field

  • Click "Save" or "Save & Close".
  • Log in to your Joomla site front-end as one of the registered users using the password of this superuser. You should see the site as this registered user.