Prepared Statements don't seem to be working

I did post about this in #d1-database , but not sure if this is a better place for it - d1-database

router.post('/:brand/:slug', async (r,e,c) => {
    const brand = r.brand;
    const slug = r.slug;
    const db = e.LINK_DB
    const body = await r.json();

    const stmt = db.prepare(`INSERT INTO ? (slug, type, data, clicks) VALUES ('?', "ArtistLanding", '?', 0)`)
    stmt.bind(brand,slug,body.data)
    return await stmt.run();
})

will always return
{
  "status": 500,
  "error": "D1_ERROR: near \"?\": syntax error at offset 12"
}


The first ? always seems to be the site of a syntax error. This is always during the bind phase (creating the statement and not binding does not cause an error)
Was this page helpful?