Skip to content

What is the problem with your ? and ?? parameters?Β #164

@suchislife801

Description

@suchislife801

Your examples are so small...

I have no idea how to execute an UPDATE query with a WHERE clause. It keeps thinking field values are field names. No documentation anywhere to learn from. Just 5 little dinky examples on your main page for people who are not really serious. You help section is soooo lacking...

WHY DOESN'T THIS WORK?

  const sqlUpdateCompany: string = 
  `UPDATE tblCompanies 
    SET 
      startDate = ?, 
      name = ?, 
      owner = ?, 
      status = ?, 
      ein = ?, 
      taxForm = ?, 
      industry = ?, 
      stateLicenseNumber = ?, 
      address1 = ?, 
      city = ?, 
      state = ?, 
      postalCode = ?, 
      email = ?, 
      phone = ?, 
      url = ?, 
      notes = ?
    WHERE 
      id = ?`;

  // EXECUTE QUERY
  const sqlUpdateCompanyResult = await MYSQL_CONN.execute(sqlUpdateCompany, [
    reqBody.params.startDate,
    reqBody.params.name,
    reqBody.params.owner,
    reqBody.params.status,
    reqBody.params.ein,
    reqBody.params.taxForm,
    reqBody.params.industry,
    reqBody.params.stateLicenseNumber,
    reqBody.params.address1,
    reqBody.params.city,
    reqBody.params.state,
    reqBody.params.postalCode,
    reqBody.params.email,
    reqBody.params.phone,
    reqBody.params.url,
    reqBody.params.notes,
    reqBody.params.id
  ]);
Error: Unknown column '2023-01-01' in 'field list'

Why does it think the the value of startDate is the field name in the database?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions