PHP code example of bmware / dmk

1. Go to this page and download the library: Download bmware/dmk 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/ */

    

bmware / dmk example snippets




use config\DatabaseConfig;

$database = DatabaseConfig::create([
  "servername" => "localhost",
  "username" => "root",
  "password" => "",
  "useExistingDatabase" => true,
  "databaseName" => "bmbuilder_testing"
]);



use config\WordpressDatabaseConfig;

$database = WordpressDatabaseConfig::create();

use queries\CreateQuery;

$database->define(function($context){
  return CreateQuery::create("test")
  ->select("email", "location", "name")
  ->values("[email protected]", "Netherlands", "boyd")
  ->values("[email protected]", "noobland", "noob")
  ->endQuery();
});

use queries\ReadQuery;

$database->define(function($context){
  return ReadQuery::create("test")
  ->select()
  ->whereEquals("email", "[email protected]")
  ->union()
  ->select()
  ->whereLessThan("email", "[email protected]", true)
  ->endQuery();
});

use queries\UpdateQuery;

$database->define(function($context){
  return UpdateQuery::create("test")
  ->select("email")
  ->values("[email protected]")
  ->whereEquals("email", "[email protected]", true)
  ->endQuery();
});

use queries\DeleteQuery;

$database->define(function($context){
  return DeleteQuery::create("test")
  ->whereGreateThan("ID", "10")
  ->endQuery();
});

$database->define(
  ReadQuery::create("test")
  ->select()
  ->whereEquals("email", "[email protected]")
  ->union()
  ->select()
  ->whereLessThan("email", "[email protected]", true)
  ->endQuery()
);

$database->define(function($context){
  return $context("excecuteQuery", "SELECT * FROM `users`")
});

$result->setUseModified(true) //tell the object to use the modifiedRow as the base for the next call

$result->getRowsByFieldValue("email", "[email protected]")->selectFields("id")->getRows("modified"); // you can chain as many as you want toghetter however some might clash with eachother

foreach(DatbaseResult $result as $row){
  //excecute function here
}