Database Function checkRowExists()

function checkRowExists(
$table, $ids, $ignoreMissingColumns = false
)

Name in Zenario 8

ze\row::exists()

Description

Checks whether a given row in a given table exists in the database.

Where You Can Use It

From Zenario 7.0.0 onwards.

Parameters

$table

The name of a table to check.

$ids

An associative array of keys (column names) to values to search for; see Format of $id and $values for Database Functions for details.

 

Return Value

Returns true if the given row exists or false if it does not.

Notes

Queries will be run against the last database that was connected to. This will be the local database, unless you switch database using a function such as connectGlobalDB() or connectHubDB().

Example

checkRowExists('users', array('username' => 'Bob'));

Checks to see if a User called "Bob" exists.