0

I am trying to check using (IF / ELSE) if my query returns any value. What is the simplest way to do this?

Thanks

result = db.execute("SELECT * FROM home WHERE id = ? AND name = ?", str(conn), str(name))

1 Answer 1

1

db.execute always returns an array, you can always print to the console to see its content, if your intention is to debug. If what you want is to warn the user, simply check that result is not null and return the warning:

if not result:
    return apology("You have not......")

for example in the case where apology.html exists.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .