Community Support for OpenDocMan (Deprecated)
SQL Error - Printable Version

+- Community Support for OpenDocMan (Deprecated) (https://forum.opendocman.com)
+-- Forum: OpenDocMan Community Discussion (https://forum.opendocman.com/forum-5.html)
+--- Forum: OpenDocMan Support - Community Based (https://forum.opendocman.com/forum-6.html)
+--- Thread: SQL Error (/thread-427.html)



SQL Error - AaronR - 06-21-2011

Hey there

I have installed your script onto a new server (had it working on a previous server) and when you try and log in; it comes up with an error

Installed:
<!-- m --><a class="postlink" href="http://cbcuk.org/transcripts/">http://cbcuk.org/transcripts/</a><!-- m -->

Error: Error in query: SELECT web105-trans.odm_user.username FROM web105-trans.odm_user WHERE web105-trans.odm_user.id = 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-trans.odm_user WHERE web105-trans.odm_user.id = 1' at line 1

Any idea why this appears?

Thanks,
-Aaron


Re: SQL Error - Stephen - 06-21-2011

Dash in the database name.


Re: SQL Error - AaronR - 06-21-2011

Hey Steve

Thanks for the info; the host forces the dash - no way around this?

-Aaron


Re: SQL Error - Stephen - 06-22-2011

I was working on this issue as well. You can try getting some backticks in the database connection sting for the tablename and see if that helps.


Re: SQL Error - ssjoholm - 08-18-2012

Hi,

I have the same issue;

Error in query: SELECT 104628-database.odm_user.username FROM 104628-database.odm_user WHERE 104628-database.odm_user.id = 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '104628-database.odm_user WHERE 104628-database.odm_user.id = 1' at line 1

Since this is on a hosted server, I am not able to change the database name.

I tried your solution to insert back tick

/** The name of the database for [OpenDocMan */
define('DB_NAME', '`104628-database`');

But this does not seem to work, as it give me following result;

"Getting settings failed: No database selected"

Tried to add back tick in the DB_NAME in odm-init.php

$db = mysql_select_db(`DB_NAME`, $GLOBALS['connection']);

And get following;

Warning: shell_exec() has been disabled for security reasons in /storage/content/28/104628/database/public_html/opendocman/odm-init.php on line 33
Getting settings failed: No database selected

Did I misunderstand the work around with back ticks?

Regards,
Sebastian


Re: SQL Error - Casper - 10-14-2012

I get exactly the same problem, dash in database name and unnable to rename the database.

Right after the initial login as admin (without passwd) an error message appears:
Error in query: SELECT vh6127-1db1.odm_user.username FROM vh6127-1db1.odm_user WHERE vh6127-1db1.odm_user.id = 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1db1.odm_user WHERE vh6127-1db1.odm_user.id = 1' at line 1

Is there a solution to this?
- Casper