I have a Windows 2008 R2 Datacenter server with IIS 7.5, MS SQL 2012 Express, using PHP 5.6 trying to connect to a database I created, testDB, via Windows Authentication, but am failing to do so. Here is my PHP I am using to connect to my SQL ServerInstance: When I run this I receive: Connection failed. Array ( [0]
Tag: sql-server
ReturnDatesAsStrings=>true returns timestamp with decimal & zeros
I’m using PHP 7.2, MS SQL Server, fpdf, and phpSpreadsheet to create PDF and Excel reports of my data. Initially I had trouble returning the timestamp (date) fields in the reports, but adding “ReturnDatesAsStrings”=>true in my connection.php solved that problem. The issue now is that the date fields on the reports have a decimal and zeros added and show up
find active records from table based on date time in php and sql server
I need to fetch active records from my table. A record is active means it is not expired and the expiration time is 2 minutes after record is generated. I am using sql server database. Here is the structure for my table And my code is as follows I need the condition for DateGenerated as How can I implement this
Send PHP Error if No Rows Created
I’m trying to prevent duplicate rows from being created. My current statement works, meaning it prevents duplicates from being created, but it always returns the execution as a success, meaning I don’t get an “error” message if no rows were created. Thanks I would like to fail the sql execution if nothing was created, which isn’t done in this case.
(sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in) is there a syntax error that I’m missing?
I need to get a report based on a datetime column which is actually the average of another column for each hour of the day , so i wrote a query and put it in a for loop so i can change the hour variable for comparison, and after that i wanna echo it so i can use it to
PHP get return value of stored procedure
I have pleasure to work with legacy PHP application using SQL Server via PDO. How in PHP can I retrieve return value of stored procedure which is using RETURN statement as output channel? Example procedure If possible, I would prefer to not modify procedure. I am aware that there are similar questions, but they don’t cover this case Get RETURN
Fatal error: Call to undefined function mssql_connect() in C:AppServApache24htdocsC_DBHandler.inc using apache 2.4 and php5.6
i upgradefrom php version 2.2 to 2.4 and php 5.6 too. The problem is with the new php the function does not support mssql_connect so i installed the new driver for sqlsvr and when i made the Database connection it work fine. I need some help. How can I change this code from mssql to sqlsvr thanks you and i
Laravel multi result set query builder
I have a MSSQL stored procedure : And i am executing this with my laravel app : It just returns me the first SELECT query result. How can i get both result sets? Answer Solved by writing bellow function :
pdo connect convert to MSsql and fetch data
I had such code, which works fine and I need to get same result then I convert my database connection And now I converting this code to: How to get THE SAME RESULT AS IN MY FIRST CODE WITH PDO Connection ? At first PDO example I get echo $json such data structure: Answer Working example: Notes: Example is tested
PHP sqlsrv_connect to SQL Server: A network-related or instance-specific error has occurred while establishing a connection to SQL Server
I want to connect PHP 7.1 to SQL Server. I add compatible drivers from: https://docs.microsoft.com/en-us/sql/connect/php/microsoft-php-driver-for-sql-server try { $serverName = “tcp:…