Welcome Guest, Not a member yet? Register   Sign In
Query builder return NULL on second iteration
#2

(This post was last modified: 04-10-2021, 08:25 PM by iRedds.)

This answer does not solve your problem. But he explains that with your code you will NEVER get a record with ID 67.

Every time you make the same request to the database
Code:
SELECT * FROM some_table WHERE post_id = 32 AND meta_key = 'category' AND meta_value = 1
And each time your query returns both records from the database, because both records match the query condition.

Next, you call the getRow() method with no arguments, which means it always returns the first value from the result.
That is, it will always be a record with ID 40.


The getRow() method will return null only in one case, when the query result is empty.

You can get the last SQL query through the BaseConnection class method:
PHP Code:
$this->db->getLastQuery() 
Reply


Messages In This Thread
RE: Query builder return NULL on second iteration - by iRedds - 04-10-2021, 08:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB