trying to make SELECT and INSERT work

SpoilerC$50 Finance

so ive had the idea to call a function that will select or insert into the database, cause of all the repetition and all, but it seems i tried too much to early.

this is my implementation of register:

https://preview.redd.it/xormovuwy0241.png?width=970&format=png&auto=webp&s=8db3cfaf9a4f455fa8673827c4a61f808b00aa6c

and these are the two function i made in helpers.py

https://preview.redd.it/hbdq02h9z0241.png?width=691&format=png&auto=webp&s=b4341eb283a2bc7017096cc14592c287d3f3336c

and according to debug50 it doesnt seem to work well....

https://preview.redd.it/puqnrvag01241.png?width=541&format=png&auto=webp&s=352b21bd2a626770f618301651edda783b305766

and i get an error later: session["user_id"] = rows[0]['id']

IndexError: list index out of range

​

my theory is that the quotation is the problem, and as you can see, ive tried getting rid of it.

i know i should probably just do all of these the normal way, but now it's a matter of principle , you know?

so i would be very happy for any advice!

Posted Dec 1, 2019, 1:49 PM UTC

32
Loading comments…