GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - irfaardy/simple-db-framework: 📙simple php db Framework

BranchesTags
Open more actions menu

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
Irfa
Irfa
 
 
Autoloader.php
Autoloader.php
 
 
README.md
README.md
 
 
example.php
example.php
 
 

Repository files navigation

Simple DB Operation Framework with PHP

Configuration

Config file : Irfa/config/database.php

<?php
$config = [
    'DB_host' => 'localhost',
    'DB_name' => 'database_name',
    'DB_username' => 'yourusername',
    'DB_password' => 'yourpassword',
    'DB_port' => '3306',
    'DB_driver' => 'mysql',
   ];

Basic Usage

Fetch all rows

  <?php
    require 'Autoloader.php';
    use Irfa\DBOperation as DB;
    
    $res = DB::table('book')->get();
     foreach ($res as $r):
        echo $r['title']."<br>";
      endforeach;

Fetch Single row

  $data= DB::table('book')
    	->where(['book_id' => 'ABC123'])
    	->first();
    	
    	echo $data['title'];

Select specific column

  $data= DB::table('book')
        ->select(['book_id','title','synopsis'])
    	->where(['book_id' => 'ABC123'])
    	->first();
    	
    	echo $r['book_id'].' '.$data['title'].' '.$r['author'];

Order by

$res = DB::table('book')->orderBy('author','DESC')->get();
         foreach ($res as $r):
            echo $r['title']."<br>";
          endforeach;

Insert Data

  $params = ['title'=>'Lorem', 'author' => 'Ipsum'];
  DB::table('book')->insert($params);

Update data

$params = ['title'=>'Ipsum', 'author' => 'Lorem'];
DB::table('book')
->where(['book_id' => 'ABC123'])
->update($params);

Delete data

DB::table('book')
	->where(['book_id' => 'ABC123'])
	->delete();

About

📙simple php db Framework

Topics

autoloaderdatabasedatabase-frameworkdb-operationsirfalightweightmysqlpdopgsqlphpsimple

Resources

Readme
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.