Re: php and microsoft sql-server via mssql
| From: | Andreas Adler | Date: | Thu, 05 Oct 2000 12:08:15 +0000 |
| Subject: | Re: php and microsoft sql-server via mssql | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3344@lists.php.net to get a copy of this message | ||
the problem starts exactly where your script ends... the data gets scrambled
on it's way from sql-server to the browser. i have tried php3 but got the
same results as ever. german-specific-character won't display correctly,
eventhough they are stored correctly in the db. i probably have to give up
on that with the awareness, that on some machines it works and on some not.
mine's a bad one...
""Jeroen ten Berge"" <j.ten.berge@getexo.nl> wrote in message
news:NDBBIEFFBBEFHIFIMHHPOELJCLAA.j.ten.berge@getexo.nl...
> I didn't have to make special efforts, but I'll show some sample code and
> explain about the DB setup :
> The database is MS SQL Server v7.0 with SP2, it was installed with the
> default settings (i.e. case insensitive and accent insensitive);
> The DB run's on a different windows nt4/SP6a quad processor machine 512
MB;
> The webserver runs on NT4/SP6a dual processor machine with IIS3 and
> PHP3.0.16 with mssql libraries.
> The table for the translation looks like this :
> Name : tblTranslator
> Fields : IdentKey(int4,identity seed
>
1),Application(varchar(50)),Form(varchar(50)),Type(varchar(15)),EasyName(var
>
char(50)),objName(varchar(50),required),Language(varchar(50),required),objTe
> xt(varchar(512),required), unique index on form/objName/Language
> combination.
> Notice that I didn't use unicode here because I want to store the data as
is
> !
> Now this is the function used to obtain the translation for a certain
object
> :
>
> /*This function generates an array for the translation of the
> objects, it returns an array in the form
> Array["<objName>"]
> This Array["<objName>"] returns a string for the object. */
> function GetLangInfo($CookID,$Form)
> {
> global $dbserver, $username, $password, $database;
> /* Retreive language for this session*/
> $query="SELECT at5 FROM mycompany.tblWebSession WHERE CookID =
> \"$CookID\"";
> mssql_connect($dbserver,$username,$password) or die("Database is down");
> mssql_select_db($database) or die("Database is down");
> $result = mssql_query($query) or die("Query failed");
> $row = mssql_fetch_array($result);
> mssql_close();
> $tmp=$row['at5'];
> $query="SELECT objName,objText FROM mycompany.tblTranslator WHERE
Language
> = \"$tmp\" and Form=\"$Form\" and Application=\"RMA Web
> client\"";
> mssql_connect($dbserver,$username,$password) or die("Database is down");
> mssql_select_db($database) or die("Database is down");
> $result = mssql_query($query) or die("Query failed");
> while ($row=mssql_fetch_array($result))
> {
> $objName=$row['objName'];
> $RetArray[$objName]=$row['objText'];
> }
> mssql_close();
> return $RetArray;
> }
>
> Here this function is called for the translation :
> /*Get language info for this form :*/
> $LangArray = GetLangInfo ($CookID,"MainMenu");
> /*Get common language info :*/
> $LangCommon = GetLangInfo ($CookID,"Common");
> echo "<title>".$LangArray['MainMenuTitle']."
".$CusInfo['CustomerName']."
> !</title>";
>
> So here the title for the generated page is in the language specific for
> this session (it's a custom session handler btw)
>
> L8r,
> Jeroen.
>
>
> -----Original Message-----
> From: Andreas Adler [mailto:fox@media-plus.ch]
> Sent: Thursday, October 05, 2000 8:51 AM
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] php and microsoft sql-server via mssql
>
>
> hi jeroen
>
> i actually do need info from you: you seem to be my man... hehe. i am
using
> php4.02
> which i think can't be the problem. did you have to make special efforts
in
> order to
> get that to work or did it work right the first time? do you have to
convert
> the text
> once you've sent the query?
>
> thank you so much for your help!
>
> regards
>
> nd.
>
> ""Jeroen ten Berge"" <j.ten.berge@getexo.nl> wrote in message
> news:NDBBIEFFBBEFHIFIMHHPAELICLAA.j.ten.berge@getexo.nl...
> > Hi y'all,
> >
> > The site I created for our customer is running PHP3.0.16 on NT4/IIS3
with
> > mssql v7;
> > The website is international in which I mean every text on the pages
> appear
> > in their native language, those translations are get from the SQL
> database;
> > We don't use ODBC however, but the native mssql library, we do get the
> > unicode char's...
> >
> > If you need info on this, then don't hesitate to ask.
> >
> > Regards,
> > Jeroen.
> >
> >
> > -----Original Message-----
> > From: Ermanno Iannacci [mailto:ermannov@libero.it]
> > Sent: Tuesday, October 03, 2000 4:43 PM
> > To: Andreas Adler
> > Cc: php-db@lists.php.net
> > Subject: Re: [PHP-DB] php and microsoft sql-server via mssql
> >
> >
> > Tried with special characters, that is ü or ß.
> > I think there's a function in PHP to convert'em automatically.
> > There's also a couple of Transact-SQL functions you can use directly in
> SQL
> > statements (MS of course): they are CAST and CONVERT. I've never used
> them.
> > I think they were designed for dates, but on-line help says they are for
> > language-dependent situations.
> >
> > ----- Original Message -----
> > From: "Andreas Adler" <fox@media-plus.ch>
> > To: <php-db@lists.php.net>
> > Sent: Wednesday, October 04, 2000 5:30 PM
> > Subject: Re: [PHP-DB] php and microsoft sql-server via mssql
> >
> >
> > > just with visualisation as it seems... did not even check to
> insert/update
> > > data... due to the fact i checked that with odbc and it worked out
well.
> > >
> > >
> > > ""Ermanno Iannacci"" <ermannov@libero.it> wrote in message
> > > news:00ee01c02d46$e5caaec0$51fda8c0@ciccio...
> > > > You have problems with visualization or with database operations?
> > > >
> > > > ----- Original Message -----
> > > > From: "Andreas Adler" <fox@media-plus.ch>
> > > > To: <php-db@lists.php.net>
> > > > Sent: Wednesday, October 04, 2000 5:13 PM
> > > > Subject: Re: [PHP-DB] php and microsoft sql-server via mssql
> > > >
> > > >
> > > > > hi ermanno
> > > > >
> > > > > thanx a lot for your reply. i already tried that without any
> success.
> > i
> > > > have
> > > > > no idea what else i could try to get that working! any further
tips
> > are
> > > > > warmly welcome.. ;-)
> > > > >
> > > > > ""Ermanno Iannacci"" <ermannov@libero.it> wrote
> > > > > in message
> > > > >
> > > > > news:001201c02d44$e23abc20$51fda8c0@ciccio...
> > > > > > I think you've got to configure your database with the default
> > > language
> > > > as
> > > > > > german.
> > > > > > This way:
> > > > > > 1. Right click a server
> > > > > > 2. Choose properties
> > > > > > 3. select the "server settings" tab
> > > > > > 4. choose your language in "default language"
> > > > > >
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: "Andreas Adler" <fox@media-plus.ch>
> > > > > > To: <php-db@lists.php.net>
> > > > > > Sent: Wednesday, October 04, 2000 10:06 AM
> > > > > > Subject: [PHP-DB] php and microsoft sql-server via mssql
> > > > > >
> > > > > >
> > > > > > > hi there
> > > > > > >
> > > > > > >
> > > > > > > i've got serious problems with the native driver from php to
> > > > > mssql-server.
> > > > > > > i've got data containing german characters like ä,ö,ü
> > > > > > > that are
> > > > displayed
> > > > > > as
> > > > > > > strange characters! with the odbc-driver, that was no problem,
> but
> > > > odbc
> > > > > > does
> > > > > > > not support row-pointers, which makes it useless in my
opinion.
> > how
> > > > can
> > > > > i
> > > > > > > get that working with mssql-commands?
> > > > > > >
> > > > > > > any help on my problem is appreciated!
> > > > > > >
> > > > > > > regards
> > > > > > >
> > > > > > > andi
> > > > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > > > For additional commands, e-mail: php-db-help@lists.php.net
> > > > To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
> > > >
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-db-help@lists.php.net
> > > To contact the list administrators, e-mail:
php-list-admin@lists.php.net
> > >
> > >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-db-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-db-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>