#18928 [Fbk->NoF]: mssql_num_rows() doesn't work

From: Date: Sat, 21 Sep 2002 06:54:36 +0000
Subject: #18928 [Fbk->NoF]: mssql_num_rows() doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19939@lists.php.net to get a copy of this message
ID: 18928 Updated by: sniper@php.net Reported By: matthius@u.washington.edu -Status: Feedback +Status: No Feedback Bug Type: MSSQL related Operating System: Win2k Server PHP Version: 4.2.2 New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2002-08-15 19:41:02] kalowsky@php.net does this happen with a very simple SELECT query, that returns one row? ------------------------------------------------------------------------ [2002-08-15 19:18:37] matthius@u.washington.edu Sorry for not including that detail. Please let me clarify, the actuall query IS valid and it does succeed. It affects about 3300 rows. I am pasting my code snippet: // above is DB connection stuff, all goes well $query = ' DECLARE @Ident int INSERT INTO LastMod (lastModBy, lastModDate) VALUES ("Matt - Email Import Test", GETDATE()) SET @Ident = @@IDENTITY -- insert primary email INSERT INTO EmailAdd (personID, address, emailAddType, lastModID) SELECT newID, Col017, "primary", @Ident FROM fmFullExport WHERE Col017 != "" AND Col002 LIKE "%_%" AND COL003 LIKE "%_%" '; // execute query $result = mssql_query($query); mssql_num_rows($result); // it dies on that last line This is the error message it generates: Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in c:\inetpub\wwwroot\DBclass\index.php on line 36 ------------------------------------------------------------------------ [2002-08-15 18:24:34] kalowsky@php.net I'm not a MSSQL user, so I don't know the specifics of that query string. But if the query fails, of course you'll receive this error message from MSSQL.... the result set isn't populated, thus there is nothing to retrieve. Unless you can show this error message to work with a valid SQL query, I'm going to mark this as Bogus. If you can, you're welcome to re-open the bug and add this new information. ------------------------------------------------------------------------ [2002-08-15 17:40:45] matthius@u.washington.edu Using MSSQL 2000 The function mssql_num_rows generates the following warning: Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource At the advice of the documentation I tried making the following query: $query2 = 'SELECT @@ROWCOUNT'; $result2 = mssql_query($query2); list($affected) = mssql_fetch_row($result2); echo($affected); This generates the following error: Warning: MS SQL: Query failed All other queries work fine I can interact with the database. I have also tried the latest stable build on snaps.php.net as of today 8-15-02 the problem remains unchanged. Any help would be greatly appreciated. Thanks! Matt ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18928&edit=1

« previous php.bugs (#19939) next »