bwcc Posted June 28, 2007 Share Posted June 28, 2007 The following code works perfectly in a browser: $server="xxxxxx"; $username="xxxxxx"; $password="xxxxxx"; $sqlconnect=mssql_connect($server, $username, $password); $sqldb=mssql_select_db("msdatatest",$sqlconnect); $date = mssql_fetch_array(mssql_query("SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]")); $sql=mssql_query("SELECT WOnumber, Created, Property, UDF1 FROM tbl WHERE Completed > (SELECT DATEADD(day, 0, (SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]))) AND Status='Completed'"); require("class.phpmailer.php"); while ($row=mssql_fetch_array($sql)){ ................. } However, I'm wanting to schedule this script. When using the command line executable, I get: C:\web\mmweb>c:\php\php.exe xxxxxx.php Warning: mssql_connect(): Unable to connect to server: xxxxxx in C:\web\ mmweb\xxxxxx.php on line 5 Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link resourc e in C:\web\mmweb\xxxxxx.php on line 6 This SQL server is remote to the PHP webserver. Any help on this would be appreciated. Quote Link to comment Share on other sites More sharing options...
bwcc Posted June 29, 2007 Author Share Posted June 29, 2007 Ended up changing it from mssql_connect to odbc_connect and it works now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.