📕
Sprnva Docs
  • Introduction
  • What's New?
  • Installation
    • Requirements
    • Download Sprnva zip no composer required
    • Install Sprnva Using Composer
    • Setup Config
  • Deployment
  • File Structure
  • Database
    • Select
    • SelectLoop
    • Insert
    • Update
    • Delete
    • Query
    • Seeder
    • Paginate
    • With
    • andFilter
    • withCount
    • get
  • Query Builder
  • Migration
    • INSTANCES
      • NEW
      • RENAMETABLE
      • DROP
      • CHANGE
    • DUMPS
      • dump
      • dump prune
    • MAKE
    • MIGRATE
      • migrate
      • migrate fresh
    • ROLLBACK
  • Routing
    • with parameter
    • multiple parameters
    • with closure
    • group
    • controller grouping
  • Controllers
    • methods
  • Views
    • Passing Parameters
  • Validation
    • validate
      • validation type
  • Authentication
  • Alert Messages
  • Default Helpers
  • CSRF Protection
  • Email
  • Packages
    • Fortify
  • Themes and Templates
Powered by GitBook
On this page
  1. Database

Select

select is for retrieving a single row in the table.

// DB()->select($columns, $table, $whereParams = '')->get();

<?php

namespace App\Controllers;

class UserController
{
    public function index()
    {
        $user_data = DB()->select("*", "users", "id = 2")->get();

        return view('/index', compact('user_data'));
    }
}

The get method return the result of the query where each result is an array. You may access each column's value by accessing the column like this $user_data['fullname'].

PreviousDatabaseNextSelectLoop

Last updated 2 years ago