text: -- phpMyAdmin SQL Dump
  -- version 4.5.1
  -- http://www.phpmyadmin.net
  --
  -- Host: 127.0.0.1
  -- Generation Time: Jul 16, 2017 at 07:27 AM
  -- Server version: 10.1.16-MariaDB
  -- PHP Version: 5.5.38
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  SET time_zone = "+00:00";
  
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!40101 SET NAMES utf8mb4 */;
  
  --
  -- Database: `ci_db`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `bill`
  --
  
  CREATE TABLE `bill` (
    `id` int(11) NOT NULL,
    `id_users` int(11) NOT NULL,
    `cus_name` varchar(50) NOT NULL,
    `cus_phone` varchar(12) NOT NULL,
    `cus_email` varchar(100) NOT NULL,
    `cus_adress` varchar(110) NOT NULL,
    `total_price` float NOT NULL,
    `created_at` datetime NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `bill_info`
  --
  
  CREATE TABLE `bill_info` (
    `id` int(11) NOT NULL,
    `id_bill` int(11) NOT NULL,
    `id_product` int(11) NOT NULL,
    `quatyti` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `contacts`
  --
  
  CREATE TABLE `contacts` (
    `id` int(11) NOT NULL,
    `email` varchar(100) NOT NULL,
    `content` text NOT NULL,
    `phone` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `images`
  --
  
  CREATE TABLE `images` (
    `id` int(11) NOT NULL,
    `id_products` int(11) NOT NULL,
    `name` varchar(50) NOT NULL,
    `status` int(1) NOT NULL DEFAULT '1'
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `producer`
  --
  
  CREATE TABLE `producer` (
    `id` int(11) NOT NULL,
    `name` varchar(100) NOT NULL,
    `logo` varchar(100) NOT NULL,
    `status` int(1) NOT NULL DEFAULT '1'
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `products`
  --
  
  CREATE TABLE `products` (
    `id` int(11) NOT NULL,
    `id_producer` int(11) NOT NULL,
    `name` varchar(50) NOT NULL,
    `price` float NOT NULL,
    `quantyti` int(11) NOT NULL,
    `avatar` varchar(100) NOT NULL,
    `sale-off` float NOT NULL,
    `views` int(11) NOT NULL,
    `description` varchar(10000) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `products_info`
  --
  
  CREATE TABLE `products_info` (
    `id` int(11) NOT NULL,
    `id_products` int(11) NOT NULL,
    `display` varchar(1000) NOT NULL,
    `camera` varchar(1000) NOT NULL,
    `operating` varchar(1000) NOT NULL,
    `storage` varchar(1000) NOT NULL,
    `network` varchar(1000) NOT NULL,
    `design` varchar(1000) NOT NULL,
    `battery_charge` varchar(1000) NOT NULL,
    `utilities` varchar(1000) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `rates`
  --
  
  CREATE TABLE `rates` (
    `id` int(11) NOT NULL,
    `id_user` int(11) NOT NULL,
    `id_product` int(11) NOT NULL,
    `rate` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `slides`
  --
  
  CREATE TABLE `slides` (
    `id` int(11) NOT NULL,
    'name' varchar(500) NOT NULL,
    `images` varchar(500) NOT NULL,
    `link` varchar(100) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `tech_news`
  --
  
  CREATE TABLE `tech_news` (
    `id` int(11) NOT NULL,
    `title` varchar(500) NOT NULL,
    `intro` varchar(400) NOT NULL,
    `content` text NOT NULL,
    `images` varchar(50) NOT NULL,
    `status` int(1) DEFAULT '1'
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `users`
  --
  
  CREATE TABLE `users` (
    `id` int(11) NOT NULL,
    `username` varchar(30) NOT NULL,
    `password` varchar(50) NOT NULL,
    `fullname` varchar(50) NOT NULL,
    `email` varchar(50) NOT NULL,
    `address` varchar(200) NOT NULL,
    `phone` int(11) NOT NULL,
    `level` int(11) NOT NULL,
    `status` int(1) NOT NULL DEFAULT '1',
    `created_at` date NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `bill`
  --
  ALTER TABLE `bill`
    ADD PRIMARY KEY (`id`),
    ADD KEY `id_users` (`id_users`);
  
  --
  -- Indexes for table `bill_info`
  --
  ALTER TABLE `bill_info`
    ADD PRIMARY KEY (`id`),
    ADD KEY `id_bill` (`id_bill`),
    ADD KEY `id_product` (`id_product`);
  
  --
  -- Indexes for table `images`
  --
  ALTER TABLE `images`
    ADD PRIMARY KEY (`id`),
    ADD KEY `id_products` (`id_products`);
  
  --
  -- Indexes for table `producer`
  --
  ALTER TABLE `producer`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `products`
  --
  ALTER TABLE `products`
    ADD PRIMARY KEY (`id`),
    ADD KEY `id_producer` (`id_producer`);
  
  --
  -- Indexes for table `products_info`
  --
  ALTER TABLE `products_info`
    ADD PRIMARY KEY (`id`),
    ADD KEY `id_products` (`id_products`);
  
  --
  -- Indexes for table `rates`
  --
  ALTER TABLE `rates`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `id_user` (`id_user`),
    ADD KEY `id_product` (`id_product`);
  
  --
  -- Indexes for table `slides`
  --
  ALTER TABLE `slides`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `tech_news`
  --
  ALTER TABLE `tech_news`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `users`
  --
  ALTER TABLE `users`
    ADD PRIMARY KEY (`id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  ALTER TABLE `contacts`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `bill`
  --
  ALTER TABLE `bill`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `bill_info`
  --
  ALTER TABLE `bill_info`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `images`
  --
  ALTER TABLE `images`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `producer`
  --
  ALTER TABLE `producer`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `products`
  --
  ALTER TABLE `products`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `products_info`
  --
  ALTER TABLE `products_info`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `rates`
  --
  ALTER TABLE `rates`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `slides`
  --
  ALTER TABLE `slides`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `tech_news`
  --
  ALTER TABLE `tech_news`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT for table `users`
  --
  ALTER TABLE `users`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `bill`
  --
  ALTER TABLE `bill`
    ADD CONSTRAINT `bill_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `bill_info`
  --
  ALTER TABLE `bill_info`
    ADD CONSTRAINT `bill_info_ibfk_1` FOREIGN KEY (`id_bill`) REFERENCES `bill` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `bill_info_ibfk_2` FOREIGN KEY (`id_product`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `images`
  --
  ALTER TABLE `images`
    ADD CONSTRAINT `images_ibfk_1` FOREIGN KEY (`id_products`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `products`
  --
  ALTER TABLE `products`
    ADD CONSTRAINT `products_ibfk_1` FOREIGN KEY (`id_producer`) REFERENCES `producer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `products_info`
  --
  ALTER TABLE `products_info`
    ADD CONSTRAINT `products_info_ibfk_1` FOREIGN KEY (`id_products`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `rates`
  --
  ALTER TABLE `rates`
    ADD CONSTRAINT `rates_ibfk_1` FOREIGN KEY (`id_product`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `rates_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  