GithubHelp home page GithubHelp logo

md-aamroni / eloquent Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 8 KB

PDO Connection and MySQL Queries in PHP

Home Page: https://md-aamroni.github.io

License: MIT License

PHP 100.00%
pdo-mysql mysql-database eloquent db-connection query-builder

eloquent's Introduction

PDO Connection and MySQL Queries in PHP

workflow Copyright License Developed Copyright

Installation

composer require adecoder/eloquent
DB_APP_HOST=localhost
DB_APP_PORT=3308
DB_APP_NAME=xtra_guideasy_app_rdb
DB_APP_CHAR=utf8mb4
DB_APP_USER=root
DB_APP_PASS=

Select Statement

use Adecoder\Eloquent\Eloquent;

$query = "SELECT * FROM table_name WHERE id = :B_SEARCH;";
$param = array(':B_SEARCH' => 2);

$select = Eloquent::select(query: $query, param: $param, itself: false)->get();
dd($select);

Create Statement

use Adecoder\Eloquent\Eloquent;

$query = "INSERT INTO table_name (username, email_id) VALUE(:B_USER, :B_MAIL)";
$param = array(':B_USER' => 'md.aarmoni', ':B_MAIL' => '[email protected]');

$create = Eloquent::create(query: $query, param: $param, array: false)->get();
dd($create);

Delete Statement

use Adecoder\Eloquent\Eloquent;

$query = "DELETE FROM table_name WHERE id = :B_DELETE;";
$param = array(':B_DELETE' => 14);

$delete = Eloquent::delete(query: $query, param: $param, array: false)->get();
dd($delete);

Update Statement

use Adecoder\Eloquent\Eloquent;

$query = "UPDATE table_name SET username = :B_USER, email_id = :B_MAIL WHERE id = :B_UPDATE;";
$param = array(':B_USER' => 'md-aarmoni', ':B_MAIL' => '[email protected]', ':B_UPDATE' => 14);
$update = Eloquent::update(query: $query, param: $param, array: false)->get();
dd($update);

eloquent's People

Contributors

md-aamroni avatar

Stargazers

 avatar

Watchers

 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.