Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Q2A Core by

I am very curious why gidgreen decided to implement:

    function qa_db_read_one_value($result, $allowempty=false)

And why not directly:

    function qa_db_read_one_value($result)

while throwing back "null" if there are no results.

Why am I asking?

I too often forget to add a "true" in the end of the query! Arbitrary example:

            'SELECT parentid FROM ^categories WHERE categoryid=#',

If there is no parentid, instead of NULL we get an error message and the script breaks at this point.


1 Answer

+1 vote
Just got the answer by myself again:

There could be a value that is NULL in the database. Having NULL as default throwback would "tell" that a value exists with the value NULL even though if it doesn't.

I think that is the idea behind.