PHP code example of colshrapnel / safemysql

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

    

colshrapnel / safemysql example snippets


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

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