Tutorials & ManualsSQL YogaSQL YogaRecord ObjectsCreate Records in the Database Using SQL Record Objects

Create Records in the Database Using SQL Record Objects

You can create records in your database using a SQL Record object. This lesson will show you how using sqlrecord_create.

Create SQL Record Object

The first step is to create a SQL Record object.

put sqlrecord_createObject("lessons") into theRecordA

## theRecordA is now an array that includes all fields in the 'lessons' table.

Fill In Values For Table

Now that you have a SQL Record object you can set the column values for the new record. In this example the "title" column and "description" column are being assigned values.

sqlrecord_set theRecordA, "title", "My Lesson"

sqlrecord_set theRecordA, "description", "A short lesson I made."

Create Record in Database

Once you are done assigning values to the columns you can create the record in the database.

sqlrecord_create theRecordA

put the result into theError

put it into theAffectedRows

## In addition to the other column values, theRecordA now contains the database value for the 'id' (primary key) column.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.