PHP code example of impeck / safemysql

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

    

impeck / safemysql example snippets


$name = $db->getOne('SELECT name FROM table WHERE id = ?i', $_GET['id']);
$data = $db->getInd('id', 'SELECT * FROM ?n WHERE id IN (?a)', 'table', [1, 2]);
$data = $db->getAll("SELECT * FROM ?n WHERE mod=?s LIMIT ?i", $table, $mod, $limit);

$field = $_POST['field'];
$value = $_POST['value'];
$sql   = "SELECT * FROM table WHERE ?n LIKE ?s";
$data  = $db->query($sql, $field, "%$value%");

$array = [1, 2, 3];
$data  = $db->query("SELECT * FROM table WHERE id IN (?a)", $array);