Codeigniter App Tutorial
Lesson 1 of 10 · Codeigniter App Part 1 - Creating the Database · IT & Software
About this course
in this series we'll be building a to-do application using code igniter which is a PHP open-source framework and it's an MVC framework Model View controller so
we'll have a controller which will be controlled by the route or by the URL and it'll use the model to grab data from the database MySQL database and then the views will display our
application all right so it's it's pretty full-featured we're going to have a login system registration and then obviously I to do categories and our lists all right so let's go ahead and
login here just so you can see the whole app alright so we just have basically a landing page where we can create new lists on the fly all right so I don't know why that
button just said login but anyway here is a list all right so we added a list which we can see right here if we click on that it will show us the description any open
tasks we have and tests that we have recently completed and then over here we can have add tasks edit lists delete list so if we want to add a task I'll say my tasks and we can choose a due
date say the 30th all right so now we have our tasks here so it's a pretty nice a sample application I guess for a beginner you can see the list we have here and we have our latest tasks down
here and we can view them all right so if we if we view the new list which we just created and we delete that it's also going to delete it's also going to delete the tasks associated with it so
let's get started so the first thing we want to do is we need to set up a database and I'm using xampp for windows which is basically an apache server on a local machine comes with PHP MySQL comes
with the PHP myadmin tool so that's what we're going to use to create the database if you don't have xampp I do have a video on how to install it I mean it's pretty easy you
just want to go to Apache friends org and download it ok so let's log in here I have quite a few databases over here including the my to do database so I'm going to create a new database and I'm
just going to call it new to do all right so let's click on that and we want to create some tables the first thing we'll create is a users table this will have what is it seven
fields alright so we want to give an ID which will be an integer 11 for the length and we want this to be the primary key and we want it to auto increment all right next we want a
first-name and I'll do I'll do the types and stuff after so last name email address user name password in the password is going to eventually be encrypted we're going to
use md5 encryption for that instead of storing a plaintext password and we're going to have a registered date alright so this is going to be vodka 255 we'll just set all these to 255 email username
password registered date is going to be a timestamp and we're going to select for default we're going to select current timestamp which will be whatever time it is when the data is inserted
alright so that looks good for the users table let's save that and the next thing we want to create is a tasks table and one second let me just figure out what we're going to have here actually let's
create the list table first all right so let's see this is going to have five columns and we're going to have an ID of course and we're going to set that to primary
and auto-increment all right the next we're going to have is going to be a list name we're going to have the list body a user ID list user ID which will relate to the users table and then we're
going to have a create date okay so let's see our car actually this body is going to be text this is going to be int say 11 createdate is going to be a timestamp
and it's going to have a default of the current timestamp all right so that looks good save that and we got one more table which of course it's tasks and this is going to have seven fields seven
columns so ID and we're going to have a task name um tasks body pretty much the same fields of the list and this is going to
have a list ID which will relate to the list table due date createdate and we're going to have a boolean for is completed all right so is complete okay our car – names house body will be
text list ID will be int due date will be date create date will be a timestamp and we'll set that default to current timestamp is complete is going to be a tiny int which will have one because
it's going to be there a 1 or 0 and we want the default to be as defined and we want it to be 0 so what that means is that when we enter a task it's going to automatically be set to 0 for Inc is
complete because obviously if we just created it it's not complete alright so that looks good alright so that's all we need for our database in the next video we will download and install code
ignitor