![]() |
SQLSRV num_rows fix - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: SQLSRV num_rows fix (/showthread.php?tid=44087) |
SQLSRV num_rows fix - El Forum - 08-02-2011 [eluser]ranjudsokomora[/eluser] Hello Fellow CI Coders, I have modified the core db_driver.php so that you can use $query->num_rows() and it will return an accurate count of the rows. I did this by assigning the results of the query to the result_array [array], and checking the size of the array. Then I empty it so it looks like nothing happened. Here is what my addition to [./system/database/DB_driver.php] the query function is: Code: else I am attaching the full file for reference. SQLSRV num_rows fix - El Forum - 08-03-2011 [eluser]ranjudsokomora[/eluser] Good Day CI Coders, I am not trying to be a pest, but could I get some feedback on this? SQLSRV num_rows fix - El Forum - 08-06-2011 [eluser]Unknown[/eluser] It worked for me. SQLSRV num_rows fix - El Forum - 07-24-2012 [eluser]Unknown[/eluser] I came across this issue in a similar way finding that it will always return 0 or FALSE. I saw the change that you made but I really wanted it to work in a similar (if not identical) way to the other database drivers that CI provides. This is one reason why even though your fix will work I suggest a possible different fix. Inside the sqlsrv_result.php file in the num_rows function, originally this is what it looks like: Code: function num_rows() So the change I made to do this is as follows: Code: function num_rows() |