Hello:
I am definitely a newby, so I apologize for any frustration!
I am migrating from windows 2000 to 2003. We have a web server and a sql server. There is one PHP application we run that requires access to the SQL database. It works fine on the old 2000 Server, but will not work on the new 2003 Server. I receive the following error:
--------------------------
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 162.42.***.*** in C:\PHP\includes\adodb\drivers\adodb-mssql.inc.php on line 515
Unable to connect!PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 162.42.***.*** in C:\PHP\includes\adodb\drivers\adodb-mssql.inc.php on line 515
--------------------------
The code for the PHP page looks like:
and the code for cta_lib.inc.php is:
Anyone have any ideas what the problem may be?
Thank you!
I am definitely a newby, so I apologize for any frustration!
I am migrating from windows 2000 to 2003. We have a web server and a sql server. There is one PHP application we run that requires access to the SQL database. It works fine on the old 2000 Server, but will not work on the new 2003 Server. I receive the following error:
--------------------------
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 162.42.***.*** in C:\PHP\includes\adodb\drivers\adodb-mssql.inc.php on line 515
Unable to connect!PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 162.42.***.*** in C:\PHP\includes\adodb\drivers\adodb-mssql.inc.php on line 515
--------------------------
The code for the PHP page looks like:
Code:
<html>
<body>
<b>CTA - Global Accessories Web Purchase Order Entry Results</b>
<br>
<?php
/********************************************************************************************
GLOBAL ACCESSORIES - SOAP CLIENT
Modified by bfife for CTA
********************************************************************************************/
// INCLUDE nusoap FILE
require_once('cta_lib.inc.php');
include("adodb.inc.php");
// Set the database type for ADODB for PHP
$database_type = "mssql";
// Get the database parameters from the cta_lib.inc.php
$host = get_db_host();
$user = get_db_user();
$password = get_db_password();
// Set Globals
global $conn;
global $conn_2;
global $ADODB_FETCH_MODE;
// Get the database parameters from the cta_lib.inc.php
$conn = NewADOConnection("$database_type");
$conn_2 = NewADOConnection("$database_type");
//Connect to database or die
$conn->Connect("$host", "$user", "$password", "CTA") or die("Unable to connect!");
$conn_2->Connect("$host", "$user", "$password", "CTA") or die("Unable to connect!");
// This sets the fetch mode as an associative array, easier to address columns this way
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
// Put form variable into local variable
$purchase_order_list= $_REQUEST['purchase_orders'];
// Explode list into array
$purchase_order_array = explode(",", $purchase_order_list);
foreach ($purchase_order_array as $purchase_order) {
// Remove non-digit characters from list
$purchase_order = preg_replace( '/[^0-9X]/', '', $purchase_order );
// Only check if the purchase order is an actual number
if ($purchase_order > 0) {
// This SQL statement gets all the distinct order numbers where the supplier id is 5 - ALCO
$select_statement = "SELECT order_id FROM purchase_order_queue WHERE order_id=" . $purchase_order;
// Execute the SQL statement or die
$rs = &$conn->Execute($select_statement) or die("Error in query: $select_statement. " . $conn->ErrorMsg());
// This sets the fetch mode as an associative array, easier to address columns this way
$conn->SetFetchMode(ADODB_FETCH_ASSOC); // Return associative array
$found_record = 0;
while (!$rs->EOF) {
$found_record = 1;
// Retrieve the order fields for each row by column name
$orderid = $rs->fields['order_id'];
$rs->MoveNext();
}
// DOUBLE CHECK FOR PROCESSED ORDERS
$select_statement = "SELECT orderid FROM orders WHERE oprocessed=1 AND orderid=" . $purchase_order;
// Execute the SQL statement or die
$rs = &$conn->Execute($select_statement) or die("Error in query: $select_statement. " . $conn->ErrorMsg());
// This sets the fetch mode as an associative array, easier to address columns this way
$conn->SetFetchMode(ADODB_FETCH_ASSOC); // Return associative array
while (!$rs->EOF) {
$found_record = 1;
// Retrieve the order fields for each row by column name
$orderid = $rs->fields['orderid'];
echo "<font color=red>Already Marked as Processed in VP-ASP: <b>$purchase_order</b></font><br>\n";
$rs->MoveNext();
}
if ($found_record == 0) {
$insert_statement = "INSERT INTO purchase_order_queue (order_id,created_by) VALUES (" . $purchase_order . ",'system')";
$conn_2->Execute($insert_statement) or die("Error in query: $insert_statement. " . $conn->ErrorMsg());
echo "Added Purchase Order to Queue: <font color=green><b>$purchase_order</b></font><br>\n";
} else {
echo "<font color=red>Purchase Order Already Exists in Queue: <b>$purchase_order</b></font><br>\n";
}
}
}
// Close all database connections
$conn->Close();
$conn_2->Close();
// Say goodbye and exit
?>
<a href=submit_orders.php><img border="0" src="[URL unfurl="true"]http://www.***.com/web_orders/submit.gif"[/URL] width="58" height="28"></a>
</body>
</html>
and the code for cta_lib.inc.php is:
Code:
<?
function get_db_user () {
// corp
$db_user = "cta";
return $db_user;
}
function get_db_password () {
// d3v3l0p
$db_password = "ctaf0c2l";
return $db_password;
}
function get_db_host () {
$db_host = "162.42.***.***";
return $db_host;
}
?>
Anyone have any ideas what the problem may be?
Thank you!