using the following code i get an error from line 5 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

any ideas please it used to work before i moved my database to a new server

<?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);
?>

can you able to access the database without any issue using your php code

Can you try below code for checking connection with Database

$serverName = "";
$userName = "";
$userPassword = "";
$dbName = "";
$connectionInfo = array("Database"=>$dbName, "UID"=>$userName, "PWD"=>$userPassword, "MultipleActiveResultSets"=>true);
$conn = sqlsrv_connect( $serverName, $connectionInfo);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.