Error Connecting to SQL Server 2005 using PHP script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pugalenthi
    New Member
    • Jan 2007
    • 44

    Error Connecting to SQL Server 2005 using PHP script

    I am trying to connect to the SQL Server and then to create a database table using PHP script. The code is as follows,[php]<job id="sqlserver1" >
    <script language="PHPSc ript">
    $connection = mssql_connect(' UIE-LAPTOP-01\SQLEXPRESS', 'pugalenthi' , 'Qwert1!');
    mssql_select_db ('tempdb', $connection);
    $sql = "CREATE TABLE Catalog(Catalog Id VARCHAR(25), Journal
    VARCHAR(25), Publisher Varchar(25), Edition VARCHAR(25), Title
    Varchar(45), Author Varchar(25))";
    mssql_query($sq l);
    </script>
    </job>[/php]when i tried to run this script in a windows script host file, i got an error. The error was "call to undefined function mssql_connect() . Please help me.
    Last edited by ronverdonk; May 2 '08, 02:30 PM. Reason: code tags
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    LAST WARNING:

    As a full member you know by now that you have to enclose any code within the appropriate code tags!

    Please enclose your posted code in [code] tags (See How to Ask a Question).

    This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

    Please use [code] tags in future.

    MODERATOR

    Comment

    • pugalenthi
      New Member
      • Jan 2007
      • 44

      #3
      Please suggest a solution to the above error.

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Originally posted by pugalenthi
        Please suggest a solution to the above error.
        You will have to talk to your ISP, because this fatal error will be returned when the mssql extension is not installed or configured.

        Ronald

        Comment

        • pugalenthi
          New Member
          • Jan 2007
          • 44

          #5
          Originally posted by ronverdonk
          You will have to talk to your ISP, because this fatal error will be returned when the mssql extension is not installed or configured.

          Ronald
          It was me who had installed and configured the php. The SQL Server is also installed in the same computer. I am able to create an ODBC connection to sql server using php script.

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            The ODBC extension of PHP is not the same as the mssql extension of PHP! That is a separate, independent, extension.

            At my own (via ISP) webserver I also have mysql and ODBC, but not the mssql!

            Run the phpinfo() function at your server and see if the return screen shows mssql.[php]<?php
            phpinfo();
            ?>[/php]Ronald

            Comment

            • pugalenthi
              New Member
              • Jan 2007
              • 44

              #7
              Originally posted by ronverdonk
              The ODBC extension of PHP is not the same as the mssql extension of PHP! That is a separate, independent, extension.

              At my own (via ISP) webserver I also have mysql and ODBC, but not the mssql!

              Run the phpinfo() function at your server and see if the return screen shows mssql.[php]<?php
              phpinfo();
              ?>[/php]Ronald
              I ran the phpinfo() function and i got long page listing all but the mssql extensions.

              I have two .ini files in the path C:\PHP namely php-activescript.in i and php.ini. One was configured during active script installation. Should i remove that .ini file ?.

              Comment

              Working...