PHP Command line help w/ db connection

bwcc

Member
Jan 8, 2006
194
0
0
The below 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'");

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.