💡
10

My first CRUD app crashed hard when I tested it with real data

I spent 3 weekends building a simple book tracking app in Python, where users could add titles and authors. When I tried entering a book with an apostrophe in the title like "Harry's Game", the whole thing just blew up with a SQL error. Anyone else run into basic input problems that totally wrecked their beginner project?
3 comments

Log in to join the discussion

Log In
3 Comments
kim.jake
kim.jake5d ago
My fourth test input was "O'Brien's Irish Pub" and my app just straight up noped out of existence (which, looking back, was probably the smartest thing in the whole project). It took me like 45 minutes to realize I wasn't sanitizing my inputs at all, I was just jamming user text right into the SQL query. I felt like a real genius when I finally learned about parameterized queries - the whole thing would just silently fail or throw some cryptic error about "unclosed quotation mark".
7
paige331
paige3315d ago
Ha! That apostrophe really said "let me introduce myself" to your whole database, huh? Guess that pub name was a bit too Irish for your code to handle.
5
seth_singh20
I actually don't think parameterized queries are always better for beginners.
6