Error in SQL syntax

I tried re-installing zp in another folder and I am getting this error:

`MySQL Query ( SELECT * FROM 01_portfolio-albums ) Failed. 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 '-albums' at line 1`

Setup.php runs smoothly, and I changed all the config.php and .htaccess variables I could think of.

Does anybody have any idea what this error means?

Much appreciated.

-the_rog

Comments

  • ps. I should also include the fact that I got the error when trying to access the admin page after running setup.php successfully.

    I get this error when trying to access the gallery:

    `MySQL Query ( SELECT *, (date + 0) AS date FROM 01_portfolio-albums WHERE `folder`='' LIMIT 1; ) Failed. 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 '-albums WHERE `folder`='' LIMIT 1' at line 1`
  • trisweb Administrator
    It looks like your "mysql prefix" variable in the config file is set to '01_portfolio-' -- Table names cannot contain dashes, and I didn't check for that.

    Remove the dash (change to an underscore) and re-run setup.
  • dom Member
    Hi,

    Just to clarify, MySQL table names *can* contain dashes, but if you are going to use them then you must delimit the table name with backticks, eg:

    SELECT * FROM `01_portfolio-foo`

    edit:

    Ok, the formatting on these forums turns backticks into code, so I cannot give an example. :/
  • Thanks!
Sign In or Register to comment.