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

  • Home
  • SEARCH
  • 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 8109049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:18:03+00:00 2026-06-06T01:18:03+00:00

I’m encountering a strange issue, where sqlsrv_query() returns a valid statement resource, but sqlsrv_fetch_array()

  • 0

I’m encountering a strange issue, where sqlsrv_query() returns a valid statement resource, but sqlsrv_fetch_array() subsequently returns false. I tested my query ($q) in MS SQL Server Management Studio, so I know it returns a result with a certain number of rows. The code I have is…

$r = @sqlsrv_query($dbcMssql, $q, array(), array('Scrollable'=>'static'));    // works
$rowCount = sqlsrv_num_rows($r);    // this shows there are correct number of rows
$row = sqlsrv_fetch_array($r, SQLSRV_FETCH_ASSOC);    // $row is FALSE

I’m using the same bit of a code on another MSSQL database, and it is working without any problem. The only difference with this MSSQL DB is that it uses BIGINT for its primary key and some of the column names are different (not that this matters).

What am I doing wrong?

UPDATE:

Whilte $stmt is not false, I looked at the error anyway, and it gives me

        [0] => IMSSP
        [SQLSTATE] => IMSSP
        [1] => -35
        [code] => -35
        [2] => Invalid type
        [message] => Invalid type

The IMSSP leads me to believe that, according to documentation at http://php.net/manual/en/function.sqlsrv-errors.php, it’s my SQL for PHP 2.0 driver that is causing the problem. I see that SQL for PHP 3.0 has been released. This could be the problem I suppose.. because the DB i’m trying to query is a newer version of MSSQL (2008? vs 2005) than the one I’ve been using previously without any problems. However, this driver has been compiled with VC9 only (2.0 was available for both), and my PHP 5.3 is compiled with VC6.. so it will not load. Does this mean I need to recompile it using the source code or re-install PHP with a VC9 version?

I don’t know how to recompile, so I guess re-installing VC9 version of PHP 5.3 is the way to go for me right now.

  • 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-06-06T01:18:06+00:00Added an answer on June 6, 2026 at 1:18 am

    There is probably something wrong with your query. You can retrieve the error message with sqlsrv_errors(), e.g. like this:

    $stmt = sqlsrv_query($tsql);
    if ($stmt === false) {
        die(print_r(sqlsrv_errors(), true));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.