Membuat CRUD PHP Dalam Satu Form - Rumah IT

Baru

recent

Membuat CRUD PHP Dalam Satu Form

Membuat CRUD PHP Dalam Satu Form

Rumahit.ID - Disini kita akan membuat Script PHP untuk operasi CRUD standar (Create, Read, Update dan Delete) . Namun bedanya disini adalah perintah tambah, hapus dan edit dilakukan dalam satu form. Jadi kamu tidak memisahkan coding antara tambah data, hapus data dan edit data di form yang lain seperti CRUD pada umumnya.


Untuk proses pengambilan data disini menggunakan metode POST, jadi tidak akan ditampilkan variabel inputan di bar URL. 
Dalam contoh ini, terdapat 3 Tabel yaitu :

1. Users  : Untuk menampilkan data user
2. House : Untuk menampilkan data rumah
3. Resident : Untuk menampilkan data penghuni rumah

-- phpMyAdmin SQL Dump
-- version 3.4.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 05, 2015 at 01:57 PM
-- Server version: 5.5.16
-- PHP Version: 5.3.8

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 utf8 */;

--
-- Database: `final_project`
--

-- --------------------------------------------------------

--
-- Table structure for table `households`
--

CREATE TABLE IF NOT EXISTS `households` (
  `ID` int(15) NOT NULL AUTO_INCREMENT,
  `houseno` varchar(10) NOT NULL,
  `housetype` varchar(25) NOT NULL,
  `firstname` varchar(25) NOT NULL,
  `middlename` varchar(25) NOT NULL,
  `lastname` varchar(25) NOT NULL,
  `purok` varchar(25) NOT NULL,
  `toilettype` varchar(25) NOT NULL,
  `watersource` varchar(25) NOT NULL,
  `dateadded` varchar(25) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `households`
--

INSERT INTO `households` (`ID`, `houseno`, `housetype`, `firstname`, `middlename`, `lastname`, `purok`, `toilettype`, `watersource`, `dateadded`) VALUES
(7, '13', 'Bungalow', 'rommel', 'batino', 'pobre', '2', 'Toilet Bowl', 'Electric Pump', 'October 19, 2015'),
(9, '11', 'Concrete', 'edf', 'frfr', 'frffr', 'rfrfr', 'Toilet Bowl', 'Manual Pump', 'October 20, 2015'),
(10, 'gby', 'Concrete', 'hy', 'hyh', 'hyh', 'hyh', 'Toilet Bowl', 'Manual Pump', 'November 02, 2015');

-- --------------------------------------------------------

--
-- Table structure for table `personal_info`
--

CREATE TABLE IF NOT EXISTS `personal_info` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `firstname` varchar(25) NOT NULL,
  `middlename` varchar(25) NOT NULL,
  `lastname` varchar(25) NOT NULL,
  `age` varchar(45) NOT NULL,
  `birthdate` varchar(45) NOT NULL,
  `education_attain` varchar(45) NOT NULL,
  `occupation` varchar(45) NOT NULL,
  `civilstatus` varchar(45) NOT NULL,
  `gender` varchar(45) NOT NULL,
  `mobile` varchar(45) NOT NULL,
  `houseno` varchar(45) NOT NULL,
  `purok` varchar(45) NOT NULL,
  `dateadded` varchar(45) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `personal_info`
--

INSERT INTO `personal_info` (`ID`, `firstname`, `middlename`, `lastname`, `age`, `birthdate`, `education_attain`, `occupation`, `civilstatus`, `gender`, `mobile`, `houseno`, `purok`, `dateadded`) VALUES
(4, 'Rommel', 'Batino', 'Pobre', '20', '2015-10-20', 'College', 'Student', 'stat', 'Male', '090367532', '11', '4', 'October 20, 2015'),
(5, 'gaga', 'nana', 'mama', '75', '1975-03-23', 'Elementary', 'efjhruhg5g', 'Married', 'Female', '090577676326', '22', '3', 'October 20, 2015'),
(6, 'vth', 'hyh', 'hyh', '23', '2015-10-15', 'High School', 'r4tt5', 'stat', 'Male', 'vtv', '45', 'bg', 'October 21, 2015');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `usertype` varchar(25) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(50) NOT NULL,
  `firstname` varchar(25) NOT NULL,
  `lastname` varchar(25) NOT NULL,
  `address` varchar(100) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`ID`, `usertype`, `username`, `password`, `firstname`, `lastname`, `address`) VALUES
(3, 'WebAdmin', 'Admin', 'password', 'Rommel', 'Pobre', 'Rommelpobre2@gmail.com'),
(6, 'User', 'ok', '22', 'ka', 'lang', '4r4r442sd@sbfhfr'),
(7, 'User', 'weh', '12', 'di ', 'nga', 'rr4r4r4@sdvgefe'),
(8, 'User', 'efef', '12', 'wdr4', 'ff', 'rf5g5@huyr4');

/*!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 */;

Membuat CRUD PHP Dalam Satu Form
Screenshot Program

Untuk script lengkapnya silahkan bisa di Download disini : CRUD satu form
All Rights Reserved by Rumah IT - Rumah Teknologi Informasi © 2013 - 2022
Powered By Blogger

Contact Form

Name

Email *

Message *

Powered by Blogger.