ldo is a simple todo application being written in php (not completed yet).
Cause I am learning it! I am getting php training sessions at my college.
- login, sign-up feature
- multi-user support
- holds session for certain time
- use of mysql database
- edit/delete todos
- mark as done will be addded soon
- You should have installed and enabled php and mysql servers or just install xampp/lampp and start it.
- Database configuration is done in config.php.
- Two tables
todos
andusers
should be created.- Columns in
users
table areid (primary_key + auto_increament)
,email
,password
,name
, andimage
. - Columns in
todos
areid (primary_key + auto increament)
,title
,description
, anduser_id
. id
ofusers
table anduse_id
oftodos
table should be same and interconnected so, join them using foreign key.
- Columns in
Practically,
-
Create a database (give any name) and then configure it accordingly in config.php.
-
Create a table
users
in database.
CREATE TABLE `users` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(155) NOT NULL,
`email` VARCHAR(255) NOT NULL,
`password` VARCHAR(155) NOT NULL,
`image` VARCHAR(255),
PRIMARY KEY (`id`)
);
- Create a table
todos
in same database.
CREATE TABLE `todos` (
`id` INT NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`user_id` INT NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY(`user_id`) REFERENCES users(`id`)
);
The table should look like following:
- image name is generated randomly and image name is saved in image column of users table in database.
- real image is saved in uploads directory.