Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6384387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:46:11+00:00 2026-05-25T02:46:11+00:00

I am using the sqlsrv driver for IIS so I can connect to a

  • 0

I am using the sqlsrv driver for IIS so I can connect to a MS SQL server in PHP.

I’ve managed to convert a lot of my original mysql_ code and all going well, until I tried to SELECT some DateTime fields from the database. They were coming back as Date objects in PHP rather than strings, I found the fix which is adding this to the connection array:

‘ReturnDatesAsStrings’=>1

Since doing that though my code is broken when trying to populate my recordset:

    function row_read($recordset) {

    if (!$recordset) {
        die('<br><br>Invalid query :<br><br><bold>' . $this->sql . '</bold><br><br>' . sqlsrv_error());
    }

    $rs = sqlsrv_fetch_array($recordset);
    return $rs;
}

The error is: sqlsrv_fetch_array(): 16 is not a valid ss_sqlsrv_stmt resource

There is such little amount of help on that error in Google so this is my only shot! I just don’t get it.

row_read is called from within a While: while ($row = $db->row_read($rs)) {

Any ideas?

Just to add more code and logic – I do a simple SELECT of all my orders, then as it loops through them, I do another 2 SELECT’s on the orders table then the customer table. It’s falling down when I try these extra 2 ‘gets’:

        $this->db->sql = "SELECT * FROM TicketOrders";  

    $rs = $this->db->query($this->db->sql);

    $this->htmlList->path("skin/search.bookings");

    if ($this->db->row_count != 0) {
        while ($row = $this->db->row_read($rs)) {

            // Load the order row
            $this->TicketOrders->get($this->db, $row['Id']);                

            // Load the customer row
            $this->Customers->get($this->db, $row['CustomerId']);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:46:12+00:00Added an answer on May 25, 2026 at 2:46 am

    sqlsrv_fetch_array need a ss_sqlsrv_stmt resource. There must be something wrong with your SQL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the SQL Server Driver for PHP to connect to an SQL Server
I am debating between using MsSQL and SQLSrv to connect to SQL Server. Our
Hi I am using a PHP script to connect to SQL Server 2005. After
I am using PHP SQL Server driver - is there a way to kill
I'm using php and sql server 2008 and the SQL Server Driver for PHP
I can´t find an explanation to this behaviour (SQL Server 2008 + PHP 5.2.14)
I am using PHP 5.3.6 on Windows and connecting to a SQL Server 2008
I'm trying to add new entries to an sql database using php, i can
What is the equivalent function for mssql_result, under Microsoft SQL Driver for PHP (sqlsrv)?
using SQL Server 2005 standard edition with SP2 I need to design a table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.