Git Product home page Git Product logo

synskuel's Introduction

Synskuel

Getting started :

include the file

require 'synskuel.php';

Connect to the database

Synskuel::connect(host, database, user, password [, options(array)]);
$options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_NUM];
Synskuel::connect('127.0.0.1', 'database', 'root', 'superpass', $options);
Query something
Synskuel::query(query [, params(array), success(callback), error(callback)];

SELECT example :

// Callbacks are optionals
Synskuel::query("SELECT * FROM table WHERE id=?", [3], function($res){
    print_r($res->fetchAll());
}, function($err){
    print_r($err);
});

INSERT example :

// Callbacks are optionals
Synskuel::query("INSERT INTO table (name, lastname) VALUES(?,?)", ['John', 'Doe']);

UPDATE/DETE example :

// Callbacks are optionals
Synskuel:: query("UPDATE table SET name=? WHERE id=?", ['Jane', 1]):
Synskuel:: query("DELETE FROM table WHERE id=?", [1]):

COUNT example :

$number = Synskuel::query("SELECT COUNT(*) FROM table");
echo $number;
// OR
Synskuel::query("SELECT COUNT(*) FROM table ", [], function($number){
    echo $number;
});

CHECK if a record exists :

Synskuel::exists("SELECT COUNT(*) FROM table WHERE name=? ", ['Jane'], function(){
    echo " Jane is in the database !";
}, function() {
    echo "Jane is not in the database !";
});
Print all errors
Synskuel::errors();
Log errors to a file
// Default file : synskuel.log
Synskuel::logs();
// Custom file :
Synskuel::logs("yourfile.ext);

synskuel's People

Contributors

sylrelo avatar

Watchers

James Cloos 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.