Jump to content

Brian Swan

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Posts posted by Brian Swan

  1. Davez69gto-

    It's difficult to say what might be going on without seeing error details. Can you provide the detailed error returned by IIS and the Windows Application Event log entries for php-cgi.exe crashes?

    Thanks.

    -Brian

  2. Looks to me like you reset the $rs statement resource within one of your conditions. I've removed some of your code to try and show this. Your initial query defines the $rs statement resource, but then you reset it within the while loop.

     

    $rs = mssql_query($SQL, $link);
    
    while ($row = mssql_fetch_array($rs))
    {
    ...
    if ($intAreas == 0) $AreasName = "All Areas";
    else
    { 
    	$SQL = "SELECT * FROM Areas where AreasID = $intAreas"; // was EarnRateName;
    	$rs = mssql_query($SQL, $link);
    	while ($rws = mssql_fetch_array($rs))
    	{
    		$AreaID = $rws['AreasID'];
    		$AreasName = sprintf("%s", $rws['AreasName']);
    	}
    }
    ...
    }
    

     

    Is that what you intended to do? Seems like that could be causing the problem.

     

    -Brian

  3. The most important thing in your php.ini file is that you have enabled the php_mssql extension. In the Extensions section you should see this line (uncommented):

     

    extension=php_mssql.dll

     

    After that, getting everything else set up will depend on whether you are on Linux/Apache or Windows/IIS. If you are on Windows, I'd suggest that you use the MSFT-supported extension (sqlsrv). More about that here: http://blogs.msdn.com/b/brian_swan/archive/2010/03/08/mssql-vs-sqlsrv-what-s-the-difference-part-1.aspx. Also, if you are on Windows, using the Web Platform Installer can make set up and configuration easy: http://www.microsoft.com/web/downloads/platform.aspx

     

    Hope that helps.

     

    -Brian

     

  4. The error you are getting indicates that the php_mssql extension is not loaded. You can verify this by calling phpinfo() - my guess is that you won't see mssql as a loaded extension.

     

    Since you are running on Windows, I'd suggest that you use the MSFT-supported extension: php_sqlsrv. You can read about the differences between those two extensions here: http://blogs.msdn.com/b/brian_swan/archive/2010/03/08/mssql-vs-sqlsrv-what-s-the-difference-part-1.aspx. You can download the sqlsrv extension here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05.

     

    Regardless of which driver you use, you need to put the extension file in your PHP extension directory, add the appropriate entry to your php.ini file, and restart your web server.

     

    Hope that helps.

     

    -Brian

  5. I don't know if the port number is the problem. The error you are showing in your first post tells me that the correct version of ODBC is not installed on the same machine that is running PHP. Have you installed the latest ODBC on that machine?

     

    If the port number is the issue, try this:

     

    $serverName        = "Zeus,1001";

     

    The way you were doing it, it looked like Zeus was an instance name (not sure that's your set up).

     

    More info here: http://msdn.microsoft.com/en-us/library/cc761422(SQL.90).aspx

     

    -Brian

  6. Are you using IIS or Apache? If you are using IIS, it is probably configured so that PHP handles only pages that end with the .php extension. If your page above is named someName.html, IIS won't know that PHP should handle the page. Not sure if Apache works similarly. My suggestion: try naming your page with .php extension and see what happens.

     

    Hope that helps.

     

    -Brian

  7. This might work, but only if you are using the sqlsrv extension for connecting to SQL Server: You could sign up for the free trial of SQL Azure (Microsoft's RDBMS in the cloud) and test against it. If you are using the php_mssql extension to connect, I'm not sure this is an option. In case you are, by chance, using the php_sqlsrv extension, this blog post will get you started with SQL Azure: http://blogs.msdn.com/b/brian_swan/archive/2010/02/12/getting-started-with-php-and-sql-azure.aspx

     

    -Brian

  8. You are right about DISTINCT applying to all three fields, but I'm having trouble understanding what data you want. (What if a client has multiple entries for a producer, or with different submitdates? Do you only want one of those rows? Which one?) I'm probably just missing something. Can you share some example data from clientTable and the result set you'd like to see? I'm sure there is a way...just need to better understand the scenario.

     

    Thanks.

     

    -Brian

  9. Check two things:

     

    1. Is the php_mssql.dll file in your extension directory?

    2. Is the php_mssql.dll extension enabled in your php.ini file?

     

    If the answer to both of those questions is "yes", then you might be missing a dependency (like the ntwdblib.dll file).

     

    BTW, since you are running PHP on Windows, I suggest you use the php_sqlsrv.dll extension. I've written about the difference between the mssql and the sqlsrv extensions here: http://blogs.msdn.com/b/brian_swan/archive/2010/03/08/mssql-vs-sqlsrv-what-s-the-difference-part-1.aspx.

     

    Hope that helps.

     

    -Brian

  10. On the off chance that you are running PHP on Windows, I'd suggest that you use the sqlsrv driver, available here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05. It is released and supported by Microsoft. This wiki entry might be a good resource for getting started: http://social.technet.microsoft.com/wiki/contents/articles/whitepaper-accessing-sql-server-databases-from-php.aspx. Please add to the article if you have helpful input.

     

    Hope that helps.

     

    -Brian

  11. Full disclosure: I work at Microsoft.

     

    I wouldn't say the PHP 5.3 "doesn't support MSSQL"...it's just that the php_mssql extension isn't shipped with PHP 5.3. You CAN get the php_mssql.dll file, enable it in your php.ini and you will have access to SQL Server (if you are running on Linux). If you are on Windows, then the recommended extension is the php_sqlsrv extension (which also comes in a PDO flavor), available here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05. I've written some blog posts about the difference between these drivers:

     

    http://blogs.msdn.com/b/brian_swan/...nce-part-1.aspx

     

    http://blogs.msdn.com/b/brian_swan/...nce-part-2.aspx

     

    Thanks.

     

    -Brian

  12. It looks to me like you have the sqlsrv extension enabled, but you are calling functions that are defined in the mssql extension. These are different PHP extensions for connecting to SQL Server. These blog posts should help you understand the differences (and write code that will work with the sqlsrv extension):

     

    http://blogs.msdn.com/b/brian_swan/...nce-part-1.aspx

     

    http://blogs.msdn.com/b/brian_swan/...nce-part-2.aspx

     

    If those links still don't help, please post with further questions.

     

    Hope that helps.

     

    -Brian

×
×
  • 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.