Textpattern logo

Help?

safe rows start

From Textbook

Contents

Description

array safe_rows_start ( string $things, string $table, string $where, boolean $debug = "" )

Returns a MySQL result resource.

Parameters

things
comma-separated list of columns to select
table
Textpattern table name, without any installation-specific prefix
where
MySQL WHERE statement, without the WHERE keyword
debug
If true, dmp() the query even when global debug mode is off

Return Values

Returns a MySQL result resource, or FALSE on failure.

Changelog

Examples

$result = safe_rows_start('name, RealName', 'txp_users', 1);
while ($r = nextRow($result)) {
    extract($r);
    $out[$name] = $RealName
}
return $out;    // user full names keyed by login name

See Also

Notes

The $where parameter is required, so you must set it to a positive value such as TRUE or 1 when you don't need an actual WHERE clause.

nextRow() is a Textpattern function for iterating over the result resource. It automatically frees the resource after the last row has been retrieved.

Translations [?]...

About Textbook