Jump to content

Brian Swan

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by Brian Swan

  1. This article has a table that lays out which .dll file to use depending on your set up: http://msdn.microsoft.com/en-us/library/cc296170.aspx -Brian
  2. If it's not too late, since you are running on Windows, you should use the Microsoft-supported sqlsrv extension. More detail 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
  3. 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
  4. You should also be using the VC9 build of the driver - that's what's recommended for FastCgi/IIS. -Brian
  5. Not silly/sloppy really....just something that you need a second set of eyes for. :-) Glad it's working now.
  6. 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
  7. 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
  8. 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
  9. It's not quite clear to me what you are trying to do. Can you post some code that shows what you are doing? That would help in figuring out if there is a better way of doing it. Thanks. -Brian
  10. 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
  11. I think you have an old version of the ODBC driver installed (the SQLSRV extension needs a newer version). You can download x86 or x86 versions from this page in the SQLSRV documentation: http://msdn.microsoft.com/en-us/library/cc296170(SQL.90).aspx (Look where it says Microsoft SQL Server 2008 R2 Native Client.)
  12. 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
  13. Give this a try: SELECT * FROM news WHERE show = 'true' AND YEAR(date) = 2011 AND MONTH(date) = 1 ORDER BY date desc, id2 desc Hope that helps. -Brian
  14. If you are using IIS 7, you should check out the PHP Manager. You can download it here: http://phpmanager.codeplex.com/releases/view/59970. This video will show you what you can do with it and how to use it: http://blogs.msdn.com/b/brian_swan/archive/2010/12/16/video-tour-of-php-manager-for-iis.aspx. Hope that helps. -Brian
  15. 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
  16. This may not be the problem (maybe just typos in the forum post?), but it's worth checking... In your second code example, the parameters that are passed to odbc_connect do not match the names used to define them (they are all missing the underscore in their names). Does this work? $connection_id = odbc_connect($db_server, $db_user, $db_pass); -Brian
  17. Have you tried using square brackets around User to indicate it is not the keyword user? $sql="SELECT CAST UserID AS TEXT FROM [user]"; This works for me. Hope that helps. -Brian
  18. For what it's worth, the Web Platform Installer (which you can download here: http://www.microsoft.com/web/downloads/platform.aspx) will install PHPBB and all the prerequisites for running it on Windows/SQL Server. If you are still stuck, it might be worth giving this a try. -Brian
  19. You should be able to get more detailed error information...can you get the error code and the more detailed error message? That will hep in figuring out what is going on. And, are you running PHP on a Windows machine? Thanks. -Brian
  20. 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
  21. 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
  22. 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
  23. 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
  24. The first thing to check is that SQL Server is configured to allow remote connections. This should help: http://aspnetmembershipprovider.blogspot.com/2009/02/eanble-remote-connections-on-instance.html.
  25. 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.