Contents |
2) simple_select - Used to perform a simple select query (with no joins) on a table
string simple_select ( string table [,string field(s)] [, string conditions] [, array options])
Builds a simple query, then sends it off to $db->query().
table
The table name to be queried.
field(s)
Comma delimetered list of fields to be selected.
conditions
SQL formatted list of conditions to be matched.
options
List of options: order by, order direction, limit, limit start
Returns a resource on success, or FALSE on error.
Example 1. $db->fetch_field() example (in 1.4.x)
global $db; $query = $db->simple_select("settings", "*", "name='boardclosed_reason'", array("order_by" => 'name', "order_dir" => 'DESC', "limit" => 1)); $settings = $db->fetch_array($query); /* Outputs: Array ( [sid] => 6 [name] => boardclosed_reason [title] => Board Closed Reason [description] => If your forum is closed, you can set a message here that your visitors will be able to see when they visit your forums. [optionscode] => textarea [value] => These forums are currently closed for maintenance. Please check back later. [disporder] => 2 [gid] => 2 ) */ echo "<pre>"; print_r($settings); echo "</pre>";