Jump to content

[SOLVED] Strange table name in MSSQL ...


budimir

Recommended Posts

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.

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.