Git Product home page Git Product logo

mysqliquerybuilder's Introduction

MySqLiQuerryBuilder

Examples:

  1. Simple SELECT.

    $mysql = new simple_query_builder(); $mysql->devMode = 1; //Developer mode, if error it print your SQL query, Default is 0

    $mysql->select returns assoc array, if result is 0 error, it returns false

    $res = $mysql->select("SELECT * FROM sha1", 0, 50); //0 - offset, 50 - limit if ($res) { echo $res[0]['pass'] ."
    "; //Print 1 result, at first row. print_R($res); //Print array }

  2. Simple INSERT.

    $mysql = new simple_query_builder(); $mysql->devMode = 1; //Developer mode, if error it print your SQL query, Default is 0

    $mysql->insert returns true if query is OK, and false if not OK

    $mysql->add('name','Ivan'); //Add protected value from SQL Injections. $mysql->add('address',$_POST['address']); //Add protected value from SQL Injections. $mysql->addCustom('activeTime', 'NOW() + INTERVAL 1 DAY'); //Add non protected value, good for MySQL fucntions

    Insert into table users and returns the ID generated by a query on a table with a column having the

    AUTO_INCREMENT attribute. If the modified table does not have a column with the AUTO_INCREMENT attribute, this

    function will return true.

    $res = $mysql->insert('users'); if ($res) echo 'ok'; else echo 'not ok';

  3. Simple UPDATE.

    $mysql = new simple_query_builder(); $mysql->devMode = 1; //Developer mode, if error it print your SQL query, Default is 0

    $mysql->insert returns true if query is OK, and false if not OK

    $mysql->add('name','Ivan'); //Add protected value from SQL Injections. $mysql->add('address',$_POST['address']); //Add protected value from SQL Injections. $mysql->addCustom('activeTime', 'NOW() + INTERVAL 1 DAY'); //Add non protected value, good for MySQL fucntions $res = $mysql->update('users'); //Update all users $res2 = $mysql->update('users',"id = 458, AND name = 'Viktor'"); //Update user in users, where ... if ($res) echo 'ok 1'; else echo 'not ok 1'; if ($res2) echo 'ok 2'; else echo 'not ok 2';

mysqliquerybuilder's People

Contributors

antonbarinov avatar

Watchers

 avatar

Forkers

stylestd

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.