Skip to main content

Insert Data

Description

A function from your project that is used to add data to your table.

tip

Your function that will return "insertId" after successfully adding data or "0", "false" if not added successfully

Example:

src/admin/actions.ts
export async function addHero(formData: FormData): Promise<string> {
/* database query that will return "insertId" or "0" */
return data;
}

Params:

  • FormData interface to get all the fields of an HTML form