text: -- phpMyAdmin SQL Dump
  -- version 4.7.4
  -- https://www.phpmyadmin.net/
  --
  -- Host: localhost
  -- Generation Time: Mar 23, 2018 at 04:52 AM
  -- Server version: 10.1.28-MariaDB
  -- PHP Version: 5.6.32
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  SET AUTOCOMMIT = 0;
  START TRANSACTION;
  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: `samikta`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `comment`
  --
  
  CREATE TABLE `comment` (
    `id` int(11) NOT NULL,
    `pid` int(11) DEFAULT NULL,
    `uid` int(11) DEFAULT NULL,
    `text` varchar(255) DEFAULT NULL,
    `timedate` datetime DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `feedback`
  --
  
  CREATE TABLE `feedback` (
    `pid` int(11) NOT NULL,
    `uid` int(11) NOT NULL,
    `feedback` varchar(45) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `image`
  --
  
  CREATE TABLE `image` (
    `id` int(11) NOT NULL,
    `projid` int(11) NOT NULL,
    `imgname` text NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `message`
  --
  
  CREATE TABLE `message` (
    `id` int(11) NOT NULL,
    `fname` varchar(255) NOT NULL,
    `lname` varchar(255) NOT NULL,
    `email` varchar(255) NOT NULL,
    `subject` varchar(255) DEFAULT NULL,
    `website` varchar(255) DEFAULT NULL,
    `message` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `message`
  --
  
  INSERT INTO `message` (`id`, `fname`, `lname`, `email`, `subject`, `website`, `message`) VALUES
  (1, 'pasindu', 'weerasinghe', 'pasindurohana@gmail.com', 'testtesttest', 'test', 'testtesttest'),
  (2, 'Pasan ', 'Basura', 'pasan@gmail.com', 'test', 'test', '2008 has brought Samikta Construction (Pvt) Ltd to international standards'),
  (3, 'sldakjlkj', 'dlfkjslkj', 'dflk', 'dlksjdl', 'dkldf', 'dlkdflsdjfsdf');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `project`
  --
  
  CREATE TABLE `project` (
    `projid` int(11) NOT NULL,
    `projtitle` varchar(256) NOT NULL,
    `projdes` text NOT NULL,
    `image` text NOT NULL,
    `date` datetime NOT NULL,
    `userid` int(11) DEFAULT NULL,
    `feedback` varchar(45) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `user`
  --
  
  CREATE TABLE `user` (
    `userID` int(11) NOT NULL,
    `userName` varchar(255) DEFAULT NULL,
    `password` varchar(255) DEFAULT NULL,
    `userType` varchar(255) DEFAULT NULL,
    `udID` int(11) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `user`
  --
  
  INSERT INTO `user` (`userID`, `userName`, `password`, `userType`, `udID`) VALUES
  (1, 'sda', '123', 'admin', 1),
  (4, 'pasan123', '202cb962ac59075b964b07152d234b70', 'admin', NULL),
  (5, 'user1', '202cb962ac59075b964b07152d234b70', 'customer', 3),
  (6, 'user2', '202cb962ac59075b964b07152d234b70', 'customer', 4);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `userdetail`
  --
  
  CREATE TABLE `userdetail` (
    `id` int(11) NOT NULL,
    `fname` varchar(255) DEFAULT NULL,
    `mname` varchar(255) DEFAULT NULL,
    `lname` varchar(255) DEFAULT NULL,
    `nic` varchar(10) DEFAULT NULL,
    `email` varchar(255) DEFAULT NULL,
    `dob` varchar(45) DEFAULT NULL,
    `contact` varchar(45) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `userdetail`
  --
  
  INSERT INTO `userdetail` (`id`, `fname`, `mname`, `lname`, `nic`, `email`, `dob`, `contact`) VALUES
  (1, 'Pasindu', 'Pasindu', 'Pasindu', 'Pasindu', 'Pasindu', 'Pasindu', 'Pasindu'),
  (2, 'Kavinda', 'Guna', 'Sekara', '953502399V', 'pasindu@gmail.com', '1995-10-12', '0715445547'),
  (3, 'Pasindu', 'Priyashan', 'Weerasinghe', '953502211V', 'pasindurohana@gmail.com', '1995-12-15', '0778855445'),
  (4, 'asd', 'sfa', 'sfa', '953502399V', 'linda@gmail.com', '1996-12-15', '0477755445');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `comment`
  --
  ALTER TABLE `comment`
    ADD PRIMARY KEY (`id`),
    ADD KEY `comment_user_idx` (`uid`),
    ADD KEY `commect_project_idx` (`pid`);
  
  --
  -- Indexes for table `feedback`
  --
  ALTER TABLE `feedback`
    ADD PRIMARY KEY (`pid`,`uid`),
    ADD KEY `fk_project_has_user_user1_idx` (`uid`),
    ADD KEY `fk_project_has_user_project1_idx` (`pid`);
  
  --
  -- Indexes for table `image`
  --
  ALTER TABLE `image`
    ADD PRIMARY KEY (`id`),
    ADD KEY `projid` (`projid`);
  
  --
  -- Indexes for table `message`
  --
  ALTER TABLE `message`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `project`
  --
  ALTER TABLE `project`
    ADD PRIMARY KEY (`projid`),
    ADD KEY `userid` (`userid`);
  
  --
  -- Indexes for table `user`
  --
  ALTER TABLE `user`
    ADD PRIMARY KEY (`userID`),
    ADD UNIQUE KEY `userID_UNIQUE` (`userID`),
    ADD KEY `login_detail_ID_idx` (`udID`);
  
  --
  -- Indexes for table `userdetail`
  --
  ALTER TABLE `userdetail`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `id_UNIQUE` (`id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `comment`
  --
  ALTER TABLE `comment`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `image`
  --
  ALTER TABLE `image`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `message`
  --
  ALTER TABLE `message`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `project`
  --
  ALTER TABLE `project`
    MODIFY `projid` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `user`
  --
  ALTER TABLE `user`
    MODIFY `userID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
  
  --
  -- AUTO_INCREMENT for table `userdetail`
  --
  ALTER TABLE `userdetail`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `comment`
  --
  ALTER TABLE `comment`
    ADD CONSTRAINT `commect_project` FOREIGN KEY (`pid`) REFERENCES `project` (`projid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `comment_user` FOREIGN KEY (`uid`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION;
  
  --
  -- Constraints for table `feedback`
  --
  ALTER TABLE `feedback`
    ADD CONSTRAINT `fk_project_has_user_project1` FOREIGN KEY (`pid`) REFERENCES `project` (`projid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `fk_project_has_user_user1` FOREIGN KEY (`uid`) REFERENCES `user` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION;
  
  --
  -- Constraints for table `image`
  --
  ALTER TABLE `image`
    ADD CONSTRAINT `image_ibfk_1` FOREIGN KEY (`projid`) REFERENCES `project` (`projid`),
    ADD CONSTRAINT `image_ibfk_2` FOREIGN KEY (`projid`) REFERENCES `project` (`projid`) ON DELETE CASCADE,
    ADD CONSTRAINT `image_ibfk_3` FOREIGN KEY (`projid`) REFERENCES `project` (`projid`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `project`
  --
  ALTER TABLE `project`
    ADD CONSTRAINT `project_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `user` (`userID`);
  
  --
  -- Constraints for table `user`
  --
  ALTER TABLE `user`
    ADD CONSTRAINT `login_detail_ID` FOREIGN KEY (`udID`) REFERENCES `userdetail` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
  COMMIT;
  
  /*!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 */;
  