Git Product home page Git Product logo

onetomany's Introduction

ONE TO MANY CRUD NATIVE PHP

cara penggunaan :

  1. buat database dengan nama onetomany
  2. dump onetomany.sql
  3. setting connect.php sesuaikan dengan koneksi

EXPLANATION

VIEW :

  1. Mengubah hasil dari sql
  2. Perulangan untuk view setiap judul menggunakan foreach
  3. Perulangan untuk view kategori di masing-masing judul menggunakan foreach
  4. Menambahkan koma (,) untuk setiap kategori
  5. Menghilangkan (,) pada kategori yang paling akhir

INSERT :

  1. Insert isi, judul ke tabel artikel
  2. Mengubah type data kategori dari string menjadi array
  3. Mass insert id_artikel, kategori kedalam tabel kategori

EDIT :

  1. Update isi, judul pada tabel artikel sesuai id
  2. Delete semua kategori yang memiliki artikel_id
  3. Mengubah type data kategori dari string menjadi array
  4. Mass insert id_artikel, kategori kedalam tabel kategori

DELETE : Delete artikel sesuai id setting di relasi menggunakan ON DELETE = CASCADE artinya ketika data pada tabel artikel dihapus maka seluruh kategori pada tabel kategori yang memiliki artikel id yang bersangkutan akan ikut dihapus

Link Referensi : https://stackoverflow.com/questions/17979982/displaying-php-mysql-query-result-with-one-to-many-relationship/17980777 https://stackoverflow.com/questions/35726910/bulk-update-mysql-with-where-statement

onetomany's People

Contributors

ahmadkhairul avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.