CI3 num_rows on CI4 |
There is indeed something wrong. After following the instructions in the manual, https://www.codeigniter.com/user_guide/d...sults.html, code below, the following error message is sent:
"Undefined property: CodeIgniter\Database\MySQLi\Result::$getRow" PHP Code: $id = 123;
If plan A fails, relax... the alphabet is 26 letters
I believe you forgot the parenthesis on the getRow() statement.
From what I can understand the OP isn't complaining that it isn't working. He's complaining his Visual Code editor is highlighting it as an error, which is why I asked if he has the relevant extensions installed for CI4. I haven't checked though. to be honest.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
I apologize, I didn't notice the lack of parentheses, after the change it worked without problems.
If plan A fails, relax... the alphabet is 26 letters
(03-30-2022, 10:50 AM)ignitedcms Wrote: I believe you forgot the parenthesis on the getRow() statement.I do not have dedicated extensions for CI4, for php I only have intelephense, I have to do some tests, but I think the problem lies in the order in which the code in the method is executed, in my specific case the code is more complex than the example I have posted, because I was trying to figure out which was the real replacement for the nums_rows function because in various other posts different things are listed and I had created a lot of confusion
Ok, i took a test
PHP Code: $query = $this->db->table('table') So everything works, but VS Code with php intelephense extension, report error on getNumRows() -> undefined method, I don't know why but if it happens to someone else the problem is here
I tested this in Visual Studio Code too where I have installed the 'Intelephense' extension as part of the 'Codeigniter 4 Extension Pack' by Rade Reksi Susanto.
Code: $rows = $query->getNumRows(); is indeed marked as an error, which probably means that Inteliphense doesn't know the method. You shoud report it as an issue on the developers Github.
I believe it is a matter of semantics. I did the test using a real table, in VScode and using real data and it worked, because the result is displayed, however, as @JustJohnQ said Inteliphense does not recognize the method.
So although the method is not recognized, it works! PHP Code: echo '<pre>';
If plan A fails, relax... the alphabet is 26 letters
|
Welcome Guest, Not a member yet? Register Sign In |