sigma Hosting Logo
Sigma Hosting
Play Video

Wix Code- Connecting a Database to a Table

Using Wix Developer tools , this quick video shows you how to create a simple database and then use that database content to populate a table. Please subscribe and also visit my website and become a member to hear about Wix updates periodically and get additional resources..

hello Lorraine Lily here from let’s start design this short video uses Wix developer tools also known as Wix code to create a table populated by a linked database I hope you find it useful for your website and implement it if you have questions please feel free to leave me a message after the video I I’m going to show you how to create a table connected to a database and then it will be filled dynamically so first I’ve added a table by going
to the plus sign here and I have to turn on my developer tools by just checking here from tools up here and once that happens you will see this user input and you can go down and drag a table over which is what we’ve done here now this particular table is going to be for upcoming races so the name of the race the date of the race and when the registration date is so now we need to create a database that connects to it so going back to the plus
sign database create a new collection and we’re going to start creating and we’re going to call it racers and what’s this database for so when we look at site content anyone can view data from this collection which is what we’re going to be doing so we’re gonna create collection and then right here we’re gonna click on the plus sign and going to call it base name and it’s a text field they have all these different fields here as well it’s just
text ad I don’t know that feels this will be dates and we’re gonna put in a date and time field I’m also gonna add a date as text field that way depending on how we want the information to be displayed and then just add another one for registration and this will be a link to the race site so we’re gonna make it an URL and so for example we’re going to call the first race my mother race and then we’re gonna say that the date say we’re gonna say
next month and on the 30th of April and we’re gonna say that it’s begins at 8 a.m. and then here we’re going to put in the date as a text field and then registration we will put in put it on it yeah I’m just gonna put in the link to my website for now just so you get the idea ok so we have one entry there now we need to go back to our page where we have our table we have to connect this to our database and that is done by adding a data set so if
we add and go to database we’re going to add a data set right here and this is this will be invisible once we launch our page we’re going to click on manage data set we are going to connect a database so then connect our races database over here and we want it to be read-only we don’t want anyone to be able to change the information we only want them to be able to view it so it’s going to be read-only and then how many things do we want to
display so I’m going to increase this to maybe 40 just in case we have as many as 40 races and not in a time period but you could do a filter here or do a sort so this is going to sort the data by newest to oldest but you can add a sort if you want to choose a particular field so maybe we will do it by date and do it the newest to the oldest there are going to connect each of these items to the database or it within this data set so here where we
have the race data we’re going to choose the races data set so our race name is going to connect we’ve got our date we have date text and registration URL it’s preview so we have our registration we have our URL we have our date text and we have the date displayed as she’s displaying it April so we might switch that around and then the name of the race now because we have a title field which a database adds in automatically it’s pulled in this
title here and so we’re going to get rid of that because we don’t need it in our table so we go to manage table and you’ll see that it’s pulled the various references from my database so this one we’re going to delete and so we end up with the race name the date the date in text format and which I don’t think we’re going to need so I’m just gonna delete that from the table I’m not deleting it from the database it’s still in the database so we get
that so we end up with just our registration here under settings we’re going to choose month day and then year so that was just here on the settings and on the date format so now when we preview it’s gonna bring in the race the date and the registration if you don’t like the the look you can create the design here by customizing and have a look at the text and the link color maybe we’ll need let’s color the background is s which is fine we also
might want to just alter the setting and then you can also alter the width of your table since we just have three things we will make them 250 it like this okay so let’s have a look we preview there we go we have our race the date and how to register