• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP Command line help w/ db connection

bwcc

Member
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.
 
Back
Top