PHP code example of zualex / sqlcvs

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

    

zualex / sqlcvs example snippets




use \SqlCvs\SqlCvs;

$sqlCvs = new SqlCvs('mysql:dbname=test_db;host=127.0.0.1', 'root', '');
$table = 'my_table2';

if (!$sqlCvs->isExistTable($table)) {
    $sqlCvs->import($table, 'tests/example.cvs');
}

$sqlCvs->setTable($table);
$row = $sqlCvs->getRandomRow();
if (count($row)) {
    $sqlCvs->update($row['id'], ['status' => 1]);
    echo $row['value'];
}