+ 1
MySQL placeholder
For example . . . name = input ('Enter your name') Age = input('Enter your age') Sql_query = ' INSERT INTO tb_name ( col_one, col_two) VALUES ()' D = c.execute(sql_query) F = c.fetchall() Print(F) I don't know how to put a placeholder in the values bracket, so I can insert the users input into the database table
1 Answer
+ 1
Try using f-strings.
Sql_query='INSERT INTO tb_name(col_one, col_two) VALUES(f"{name}, {age}")'