Saturn
Saturn 1.0.0
Saturn 1.0.0
  • Saturn 1.0.0
  • 😁User Guide
    • Settings
      • Maintenance Mode
      • Website Environment
    • Security
      • Good security practices
      • Security Notice
    • System Requirements and Support
    • Update your Server
  • ⚠️Troubleshooting
    • Errors
      • Database Errors
      • Saturn Errors
      • Checksum Issues
  • 🧩Plugins
    • Plugins in Saturn
    • Official Plugins
      • Control Panel
        • User Guide
        • Developer Guide
          • Control Panel Hooks
    • Marketplace Plugins
  • 💻Developer Documentation
    • Getting Started
    • Libraries and Functions
      • AccountManager
        • Permissions
        • UUID
      • DatabaseManager
        • DBMS
          • Sending Database Requests
          • Query Information
          • Database Security
        • Database Actions
      • HookManager
        • Actions
        • Runners
      • HTTP
      • LanguageManager
      • PluginManager
        • Manage Plugin Content
        • Plugin Compatability
        • Check if a plugin is loaded.
        • Fetch Manifest
      • RouteManager
      • SecurityManager
        • Cross-site Request Forgery
        • Cross-site Scripting
      • SessionManager
        • Start and End Sessions
        • Validate Sessions
        • Session Data
      • TestManager
    • Security
    • Plugins
      • How to structure a plugin
      • Manifest
      • APIs
      • Checking for Dependencies
      • Power Features
        • 💤Hibernate
    • Hooks
    • Tests and Profiling
    • Global Variables
Powered by GitBook
On this page
  • Database Actions
  • Select
  • Parameters
  • Example: Selecting the logged in user.
  • Insert
  • Parameters
  • Example: Creating a new page.
  1. Developer Documentation
  2. Libraries and Functions
  3. DatabaseManager
  4. DBMS

Sending Database Requests

PreviousDBMSNextQuery Information

Last updated 12 months ago

Database Actions

A database action defines what format the function should return the data it retrieves from the database in. For more information on Database Actions please see the actions page.

Select

The Select() function allows you to select information from the database.

Select(string $what, string $from, string|null $where, string $action, string|null $order = null, string|null $limit = null)

Parameters

Parameter
Type
Description
Example

$what

string

What it should select.

id

$from

string

The database table (don't include the prefix, it does this automatically).

pages

$where

string or null

Any conditions you require.

`content` IS NOT NULL

$action

string

What it should do with the data.

all:assoc

$order

string or null (optional)

Any specific order you'd like the data in.

`url` DESC

$limit

string or null (optional)

Limit the amount of data being returned.

100

Example: Selecting the logged in user.

use Saturn\DatabaseManager\DBMS;
$DB = new DBMS();

// Returns the first value as a JSON object.
$DB->Select('*', 'user', 'uuid = '.$_SESSION['uuid'], 'first:object');

Insert

The Select() function allows you to insert information into the database.

Insert(string $into, string $columns, string $values);

Parameters

Parameter
Type
Description
Example

$into

string

The database table (don't include the prefix, it does this automatically).

id

$columns

string

The columns to insert data into.

pages

$values

string

The data to insert.

`content` IS NOT NULL

Example: Creating a new page.

use Saturn\DatabaseManager\DBMS;
$DB = new DBMS();

$DB->Insert("pages", "`id`,`url`,`title`,`content`", "NULL, '/test', 'Test page', 'This is a test page.'");
💻
Database Actions