PHP code example of uppercod / myq

1. Go to this page and download the library: Download uppercod/myq library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uppercod / myq example snippets




$pdo = new PDO("mysql:dbname=attack;host=localhost", "root", "");

$db = new MyQ\Connect([
    "db"    => $pdo,
    "prefix"=> "sample_" // opcional
]);

$data = $db->el_nombre_de_mi_tabla // prepara el cursor hacia esta tabla
          ->select()   // prepara la consulta select
          ->fetch();   // la ejecuta para obtener un resultado


$mi_tabla->select([
   "mi campo"
])


$mi_tabla->select([
   [
       "mi campo",
       "campo"
   ] // mi campo as campo
])


$mi_tabla->select([
   [
       "mi campo",
       "min"
   ] // MIN(mi campo)
])


$mi_tabla->select([
   [
       "mi campo",
       "min",
       "minimo"
   ] // MIN(mi campo) as minimo
])


$mi_tabla->insert([
   "mi campo"=>10,
   "mi otro campo"=>20,
])

$mi_tabla->update([
   "mi campo"=>10,
   "mi otro campo"=>20,
])

$mi_tabla->update()

$mi_tabla
->delete()
->where([
   "id","=","10"
])


$mi_tabla
->delete()
->where([
   "id","=",NULL
])


$mi_tabla
->delete()
->where([
   "id","!=",10
])


$mi_tabla
->delete()
->where([
   "id","[]",[1,20]
])


$mi_tabla
->delete()
->where([
   "id","{}",[1,20]
])


$mi_tabla
->delete()
->where([
   ["id","=",2],"||",["id","=",3]
])


$mi_tabla
->delete()
->where([
   "name","%","%m%"
])


$mi_tabla
->delete()
->where([
   "id","=","20",
   "age", "[]",[18,30],
   "lang", "{}", ["es","en"]
])

$mi_tabla
->select([
   "mi_tabla.*",
   "mi_otra_tabla.*"
])
->join([
   "mi_otra_tabla.ID"=>"mi_tabla.ID"
])

$mi_tabla
->select()
->setParams([
   ":ID"=>10
])
->raw("WHERE ID=:ID")

$mi_tabla
->select()
->fetch()