diff --git a/src/content/docs/d1/get-started.mdx b/src/content/docs/d1/get-started.mdx index b4fdabfe531315e..1c3d8fa92b567bd 100644 --- a/src/content/docs/d1/get-started.mdx +++ b/src/content/docs/d1/get-started.mdx @@ -359,7 +359,7 @@ After you have set up your database, run an SQL query from within your Worker. 1. Define a binding to your D1 database in your code. This binding matches the `binding` value you set in the [Wrangler configuration file](/workers/wrangler/configuration/) under `d1_databases`. 2. Query your database using `env.DB.prepare` to issue a [prepared query](/d1/worker-api/d1-database/#prepare) with a placeholder (the `?` in the query). 3. Call `bind()` to safely and securely bind a value to that placeholder. In a real application, you would allow a user to pass the `CompanyName` they want to list results for. Using `bind()` prevents users from executing arbitrary SQL (known as "SQL injection") against your application and deleting or otherwise modifying your database. - 4. Execute the query by calling `all()` to return all rows (or none, if the query returns none). + 4. Execute the query by calling [`run()`](/d1/worker-api/prepared-statements/#run) to return all rows (or none, if the query returns none). 5. Return your query results, if any, in JSON format with `Response.json(results)`.