Skip to content

Tag: sqlsrv

SQL (sqlsrv) Cursor not finishing when execute from PHP

The SQL code below works great in MSSQL but when called via php it only outputs roughly half the results. I have tried placing this in a stored procedure and executing from php but that produces the same result as well. It should be inserting 150 rows, but I am getting only 77, sometimes 78, but it is always …

Parameterising an IN clause in PHP with sqlsrv

I have a method which selects records based on an array of integers which works when specifically typed. However, when I try to replace that array with one passed in from the method parameter sqlsrv_query() returns false. I am sure this is something very simple, but the ‘obvious’ possibilities to …

SQLSRV skips a row when returning a query

The code above does what I want and returns number of rows that matches what the query returns. However, I hardcoded the three sqlsrv_next_result($result);. The query will change depending on @AmbassadorID, so that piece needs to be dynamic. I tried the following loop: But this loop skips the first row. How d…

Can Microsoft’s SQLSRV driver for PHP run on Apache?

Scenario: I have a PHP website running on Apache server I have an ERP system (MS SQL) that runs on a different server I need to connect from my website to that MS SQL server I need to work with Microsoft SQL Server in my PHP application. I’ve managed to get their SQLSRV driver for PHP running on my loca…

SQL – Select doesn’t retrieve results

I’m using sqlsrv_num_rows in order to check if a user exists in the DB. When i’m running the query in my DB i’m getting 1 result, but in my PHP I’m not getting anything (echo doesn’t print anything). Why is that? Example query I’m using PHP and MSSQL. Answer Explanations: F…

PHP/MSSQL: query result to table

I’m trying to return results from a MS SQL query, into a table. But somehow I only get a blanc page with the headers. I don’t know what i’m doing wrong or where to search for an answer. Could someone please direct me in the right way. Help is appreciated Answer What I think is that $dbh->…