If you look at documentation you will see that the return of the exec
method is of the Boolean type, that is, it will return 0 ( false
) if the operation failed or 1 ( true
) if the operation was successful. For this you always receive 1, the operation is always happening without problems.
The exec
is to execute not queries , that is, to execute commands that do not give results except for the information if it occurred without problems. Typical cases are CREATE
, INSERT
, etc.
When you are searching for information in the database, that is, you are using SELECT
you need to use methods that bring those results to a variable or can be read with other methods of the class.
To get the result you want, you'll probably need the QuerySingle method or eventually the Query . This should not be the case now, but Prepare can also be useful in other situations.
There are still other ways to access this, so check out the class documentation as a whole, you can learn a lot of cool things there, especially with the examples.
Another manual reference with more complete information and other ways to retrieve the required data using a class slightly different from the one you are using. Take a good look, it may be more advantageous to change your code to use this class.