PHP code example of rexshijaku / sql-to-ci-builder

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

    

rexshijaku / sql-to-ci-builder example snippets




use RexShijaku\SQLToCIBuilder\SQLToCIBuilder;

CIBuilder($options);

$sql = "SELECT COUNT(*) FROM members";
echo $converter->convert($sql);

$this->db->countAll('members');

$sql = "SELECT * FROM members WHERE age > 30 
                            OR (name LIKE 'J%' OR (surname='P' AND name IS NOT NULL)) AND AGE !=30";
$converter->convert($sql);

$db->table('members')
 ->where('age >',30)
 ->orGroupStart()
     ->like('name','J','after')
     ->orGroupStart()
         ->where('surname','P')
         ->where('name !=',null)
     ->groupEnd()
 ->groupEnd()
 ->where('AGE !=',30)
 ->get();