PHP code example of vilshub / dbant

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

    

vilshub / dbant example snippets



        //$pdo as PDO connection handler
        
        use vilshub\dbant\dbAnt;
        $dbAnt = new dbAnt($pdo);
        $sqlPrepared = "INSERT INTO cars SET
      	    name = ?,
            model = ?,
            color = ?,
            price = ?,
            available = ?";

        $data = ["Nissan", "Primera", "Blue", "3000", "30"];
        $exec =  $dbAnt->run($sqlPrepared, $data);
        if($exec["status"]){
            //suucess
        }

    
        //$pdo as PDO connection handler
        
        use vilshub\dbant\dbAnt;
        $dbAnt = new dbAnt($pdo);
        $sqlPrepared = "INSERT INTO cars SET
      	    name = ?,
            model = ?,
            color = ?,
            price = ?,
            available = ?";

        $data = [
            array("Nissan", "Primera", "Blue", "3000", "30"),
            array("Nissan", "Primera", "Blue", "3000", "30"),
            array("Nissan", "Primera", "Blue", "3000", "30"),
            array("Nissan", "Primera", "Blue", "3000", "30"),
            array("Nissan", "Primera", "Blue", "3000", "30"),
            array("Nissan", "Primera", "Blue", "3000", "30"),
            array("Nissan", "Primera", "Blue", "3000", "30")
        ]

        $exec =  $dbAnt->batchRun($sqlPrepared, $data);
        if($exec){
            //suucess
        }
    
 
    $obj->run($query, [$data]) 
 
$obj->batchRun($query, $data)