The following code is erroring on the connection string line 5 it used to work but then i had to move the sql server to another box and now it fails have i forgotten to do something on the sql server or is there error in my code
my error is
Fatal error: Uncaught PDOException: SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. in C:\xampp\htdocs\dailysales\includes\CPeriodOrdersJson.php:5 Stack trace: #0 C:\xampp\htdocs\dailysales\includes\CPeriodOrdersJson.php(5): ->('sqlsrv:Server=F...', 'LocalAdmin', 'CrispyCrackers') #1 {main} thrown in C:\xampp\htdocs\dailysales\includes\CPeriodOrdersJson.php on line 5
<?php
include("sqlcalendar.php");
$db = new PDO("sqlsrv:Server=FFP-X3DB\X3;Database=FFP_WebServices", "LocalAdmin", "CrispyCrackers");
$row=$db->prepare("FFP_WebServices.dbo.WEBSERV_PERIOD_ANNUAL_FIGURES_CUMMULATIVE_SELECT");
$row->execute();//execute the query
//create the array
$json_data['cols'] = array(
array('label' => 'Mon', 'type' => 'string'),
array('label' => 'COrdersTP', 'type' => 'number'),
array('label' => 'COrdersAP', 'type' => 'number')
);
$rows = array();
foreach($row as $rec)//foreach loop
{
$temp = array();
$temp[] = array('v' => (string) $rec['Mon']);
$temp[] = array('v' => (float) $rec['COrdersTP']);
If ((int)$rec['Per'] < ($CurrentPeriod)) {
$temp[] = array('v' => (float) $rec['COrdersAP']);}
Else {}
$rows[] = array('c' => $temp);
}
$json_data['rows'] = $rows;
//built in PHP function to encode the data in to JSON format
echo json_encode($json_data, JSON_NUMERIC_CHECK);
?>