Re: Mssql Connection

From: Date: Wed, 19 Jan 2005 21:40:48 +0000
Subject: Re: Mssql Connection
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-206775@lists.php.net to get a copy of this message
Pablo D Marotta wrote:
Hi there.. I´m connecting to a Ms Sql Server 2000, with the system administrator´s name, and its password. It always works fine, but... I know it´s not the safest way of connecting, so I want to use some ordinary user names and passwords. The problem is that I just can´t make it work, it always throws username errors. How should I configure this, in order to connect to mssql with ordinary usernames and passwords from php code? Here is my function code: function conectar () {
      $conexion = mssql_connect("localhost","sa","apr");
      if (!$conexion)
      {
?> <DIV align="center"> <FONT face="Arial" color="FF0000" size=3>
    <B># Can´t establish connection with database server pc.</B>
</FONT>
<FONT face="Arial" color="FF0000" size=3>font</FONT> <FONT face="Arial" color="FF0000" size=3>tags</FONT> <FONT face="Arial" color="FF0000" size=3>suck</FONT> I know nothing about MSSQL - thankgod (sorry I really can't help you there) - but I can recommend eradicating all font tags... everywhere... take no prisoners... death to frontpage (oh sorry got carried away :-). try this instead: <p style="color: #f00; font: large Arial; text-align: center;"> # Can´t establish connection with database server pc. </p> rgds, Jochem
</DIV> <?php
            exit (0);
      }
      if (!mssql_select_db(GES_WEB))
      {
?> <DIV align="center"> <FONT face="Arial" color="FF0000" size=3>
    <B># Can´t establish connection with the specified database.</B>
</FONT> </DIV> <?php
            exit (0);
      }
      return $conexion;
}


« previous php.general (#206775) next »