-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Call to a member function getResult() on true on a correct query #9453
Comments
Important context (https://forum.codeigniter.com/showthread.php?tid=92467), the returned error:
It seems that #8599 made changes to the In other words, if there is As a temporary workaround, you can use: $db = db_connect();
$resultID = $db->simpleQuery($sql);
$result = new \CodeIgniter\Database\MySQLi\Result($db->connID, $resultID);
dd($result->getResult()); |
I wasn't able to reproduce the bug based on this:
Step to reproduceCREATE TABLE IF NOT EXISTS test_data (
id INT AUTO_INCREMENT PRIMARY KEY,
col INT
);
INSERT INTO test_data (col) VALUES (1); In Home.php <?php
namespace App\Controllers;
use App\Models\UserModel;
class Home extends BaseController
{
public function index()
{
$db = \Config\Database::connect();
$sql = "
WITH cte1 AS (
SELECT col FROM test_data
),
cte2 AS (
SELECT * FROM cte1 WHERE col = 1
)
SELECT * FROM cte2
";
$result = $db->query($sql);
$data = $result->getResult();
echo '<pre>';
print_r($data);
echo '</pre>';
}
} The output
|
@ping-yee Yes, you're right. IDK what I was thinking... The The real issue is the context of keywords (statement vs. function). Here the query uses |
Do we have any regex guru here? The Shouldn't we use |
Okay, at this point any changes to the regex may not make sense, because it works fine. And what I'm thinking of (if correct) won't change anything anyway. @pippuccio76 Please remove the space after |
PHP Version
8.1, 8.3
CodeIgniter4 Version
4.6.0
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
8.0.41-0ubuntu0.24.04.1 via estensione PHP MySQLi
What happened?
Hi , when i try to launch query that does work on mysql client software (tested on adminer.php and Mysql Workbench) with 0 rows returned
Steps to Reproduce
Expected Output
0 rows returned
Anything else?
No response
The text was updated successfully, but these errors were encountered: