Does php support MS SQL Server?

Discussion in 'HTML / PHP / JavaScript / CSS' started by lc1200, Apr 6, 2006.

  1. I have a site that uses asp.net 2.0 and sql server 2005. I tried to connect using php and mssql_conect functions but I get an error :Fatal error: Call to undefined function: mssql_connect() .....

    Does php hereat discountasphave the mssql functions installed?
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    mssql_connect is not supported.

    You'll have to use ODBC_connect

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Hi,

    I have never used ODBC , but found some directions in the web.

    Seem like the connection has to be made as follows:

    # connect to a DSN "mydb"
    $connect = odbc_connect("mydb", "user", "passwd");

    And from the KB:

    DSN="SQLDSN_sqlConn";
    $DSN_User="sqlusername";
    $DSN_Passwd="sqlpassword";
    $QueryString="SELECT id, FirstName, LastName, Email FROM tblContact";

    $Connect = odbc_connect( $DSN, $DSN_User, $DSN_Passwd );
    $Result = odbc_exec( $Connect, $QueryString );


    Now, the issue here is that the SQL server I'm trying to connect to is not local.
    Where do I specify the location (IP number) ?

    F

    TIA
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    use the complete connection string as the 1st variable in the odbc_connect command

    eg.

    odbc_connect('DRIVER={SQL Server};SERVER=<serverName>;DATABASE=<database_name>', '<DBUser>', '<DBPassword>')

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. Yes, odbc_connect() can work, of course. But you are a company which is charging as much for a specifically MS SQL 2000 database connection as for the hosting itself... why would you not support mssql_connect() ?

    If you think that one is as good as the other, please bear in mind that developers, like ourselves, have an end-client; and we're trying to build a system to their specifications... to run on their architecture. Discountasp.net are providing our development environment, because the client wanted a specific environment we can't provide in-house. But your service loses value value every time we can't develop and test what they've asked for, and have to make a workaround.

    Straight-up, it would be really useful to have a page with an exhaustive list of things you don't support, in your knowledgebase.
     

Share This Page