Skip to content
Advertisement

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 one

sql update multiple column in a foreach loop using prepared statement

Im studying this PHP script on how to prepare for multiple execution of a UPDATE statement. The script below shows update for 1 column using prepared statement. Example from PHP manual https://www.php.net/manual/en/function.sqlsrv-prepare.php What if I have multiple column to update, how do I create an array to bound multiple variables to a prepared statement in foreach? New update SQL statement

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 me do not work. Working Version Not Working Version 1

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 do I fix this? Thanks! Answer Use sqlsrv_has_rows(). This

SQL Server Time Format is not equal to Client Side Time format

I’m trying to compare the client side time format (“14:00”) to SQL Server time format (“14:00:00.0000000″) with SQL Query, technically is not equal because SQL Server time format has seconds and milliseconds, so I tried to concatenate the seconds and milliseconds to client side time format in PHP script like this 14:00.”:00.0000000″ and yet is not equal to SQL Server

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 localhost

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: Function sqlsrv_num_rows() requires a client-side, static, or keyset cursor, and

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->query($sql) is the reason

Advertisement