Placeholders in system.db.runPrepUpdate

I’m using the following script to delete rows from a database table:

id = event.source.id

if system.gui.confirm(“Are you sure you want to delete the selected Program?”):
system.db.runPrepUpdate(“DELETE FROM fw_6870101_recipes WHERE fw_6870101_recipes_ndx = ?”, [id])
system.db.refresh(event.source.parent.getComponent(‘Dropdown’), “data”)
system.gui.messageBox(“Program deleted”)

So far it works perfect.
Now I need to be able to change the table name (fw_6870101_recipes). The customer wants a simple text field to enter another table name.

Can I use a placeholder as table name and how would the script look for this?

Thanks.

table = event.source.parent.getComponent(‘Text Field’).text
system.db.runPrepUpdate(“DELETE FROM %s WHERE fw_6870101_recipes_ndx = ?” % table, [id])

Works!

Thank you