DataStore manipulation for database

how to insert or update records from DataStore to my database

Use a (hidden) form to post the values to the database.

Don’t forget to verify the values in the DataStore with those in the database, DataStore can be fiddled with, like all values on the client side.

Thank you very much Ben.

the problem is that the datastore keeps various data, such as a shopping cart

Assuming a shopping cart, the DataStore will have something like
ProductID, ProductName, Price, Quantity.

If the data is fiddled with, the price will be the main target. For this reason, we need the ProductID and the Quantity as the values that are obtained from the DataStore. The ProductName and Price need to be obtained from the secure Serverside data,

The construct of the code will look like:

Form insert in database
    Repeat dsCart
        dmx-serverconnect (filtered on ProductID)
            input dsCart.ProductID
            Input dsCart.Quantity
            input scProduct.ProductName
            input scProduct.Price

Note the Server Connect inside the dsCart repeat region.

1 Like

I wasn’t aware of that detail.

thank very muche ben.

1 Like

Do you have a tutorial showing step by step?

Hey @Valtenci,

I’m working on the part-2 of a shopping Cart using Data Store with Array Fields.
The client-side workaround is here:

Solved the Insert procedure and working on the Update now…
The following days I will upload it my friend.

2 Likes

hello, I managed to do everything, except save the DataStore data in my Database.

so is there a way to save according to Teodor’s tutorial, using inputs within the repetition form?

There is no other way to save data from the DataStore to the Database?.

Have a look at

1 Like