budimir Posted November 30, 2008 Share Posted November 30, 2008 Guys, I have a problem. I have taken over a job to create a program in PHP which would connect on MSSQL and write and read data from it. The problem is that the guy which created the DB, didn't use standard marking for fileds and names. The name of the table on which I need to connect and put data in is "Drezga Deržič d_o_o_$OvlasteniServis" and PHP is not working with that. I'm getting an error message "Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near 'Derži�'. (severity 15) in C:\wamp\www\erp\sql_servis.php on line 88". Could I somehow trick PHP and replace "Drezga Deržič d_o_o_$OvlasteniServis" wth "Drezga_Derzic_d_o_o_$OvlasteniServis" or even simplier, but that I can still connect to that table??? Does anyone have a solution how to go around this? Unfortunatelly I can't rename the table. It has to stay in that way. Quote Link to comment https://forums.phpfreaks.com/topic/134857-solved-strange-table-name-in-mssql/ Share on other sites More sharing options...
Mchl Posted November 30, 2008 Share Posted November 30, 2008 Enclose 'strange' names in [] Quote Link to comment https://forums.phpfreaks.com/topic/134857-solved-strange-table-name-in-mssql/#findComment-702197 Share on other sites More sharing options...
budimir Posted November 30, 2008 Author Share Posted November 30, 2008 Thanks Mchl, But, when i did that. This is the error message I got. Warning: mssql_query() [function.mssql-query]: message: Invalid object name 'Drezga Deržić d_o_o_$OvlasteniServis'. (severity 16) in C:\wamp\www\erp\sql_servis.php on line 88 What does that mean??? I'm sure that table exists and has that name! Quote Link to comment https://forums.phpfreaks.com/topic/134857-solved-strange-table-name-in-mssql/#findComment-702204 Share on other sites More sharing options...
Mchl Posted November 30, 2008 Share Posted November 30, 2008 I'm sorry, but I can't help you more than that. I have no experience with MSSQL. The [] is about only thing I know about it Perhaps you need to add some quotes, but I'm just guessing right now. Quote Link to comment https://forums.phpfreaks.com/topic/134857-solved-strange-table-name-in-mssql/#findComment-702230 Share on other sites More sharing options...
corbin Posted November 30, 2008 Share Posted November 30, 2008 Whoa..... I don't know what language that table name is, or the charset it uses, but it looks to me like you need to rename them. Just rename them something more... Englishly, for lack of a better word. Something with a-z0-9. I think PHP is having trouble sending the name correctly, and MSSQL is probably having problems too. If you want to try to get it to work correctly, you could try saving the PHP file in UTF8 without BOM. (Or you could try unicode, but I don't know if you can save PHP sources in Unicode.) Quote Link to comment https://forums.phpfreaks.com/topic/134857-solved-strange-table-name-in-mssql/#findComment-702329 Share on other sites More sharing options...
budimir Posted December 1, 2008 Author Share Posted December 1, 2008 Thanks corbin, but unfortunatlly I can not rename that table name, because then there is a lot of other stuff that will not work. Is there any other solutions? Quote Link to comment https://forums.phpfreaks.com/topic/134857-solved-strange-table-name-in-mssql/#findComment-703188 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.