Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
CodeIgniter

Query Builder in CodeIgniter

Build SQL queries safely with CodeIgniter’s Query Builder instead of raw strings.

Query Builder in CodeIgniter — a practical guide to CodeIgniter query builder with clear examples you can reuse in real projects.

CodeIgniter Tutorial Series (31/74). Prefer one article? Read the complete CodeIgniter tutorial.

Short description

Query Builder helps prevent SQL mistakes and supports chaining for select/where/join/order.

Query Builder select

$db = ConfigDatabase::connect();
$posts = $db->table('posts')
    ->select('id, title, created_at')
    ->where('is_published', 1)
    ->orderBy('id', 'DESC')
    ->get()
    ->getResultArray();

Leave a reply

Your email address will not be published. Required fields are marked *