Create php MVC app. Create database

Home » Tutorials » PHP+MySQL » Create php MVC app. Create database

In last lesson we began to create our PHP MVC application. Today we will create database with phpmyadmin using.

Our database will be consist of 5 tables:

  • roles
  • users
  • orders
  • products
  • productsInOrders – linked table between products and orders.

We will create links between tables. You can see my tutorial about links in mysql. Why we must make links? Let’s imagine the situation – you have hot several users in database with some roles. If you remove role, user will lost his role – it will be violation in the data structure. That’s why you need to track any action with users or roles data. It’s clear that you can remove user, but it os not good to remove role, if any user has got this role. That’s why we will use links.
One more feature, we will consider, MySQL functions. In users table we have got password column. But it is not a good practise to store original passwords in database. You must hash passwords. For this purpose MySQL has got MD5 function. PHP has got the same function. You must use all good capabilities to store any private data in your applications.
In next lesson we will begin to write code.

Подписаться на рассылку

Будьте в курсе - получайте последние статьи на свой email

Ваша подписка успешно оформлена

Pin It on Pinterest

Share This