Simple Select


Contents

[edit] $db->simple_select

2) simple_select - Used to perform a simple select query (with no joins) on a table

[edit] Description

string simple_select ( string table [,string field(s)] [, string conditions] [, array options])

Builds a simple query, then sends it off to $db->query().

[edit] Parameters

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

[edit] Return Values

Returns a resource on success, or FALSE on error.

[edit] Examples

Example 1. $db->fetch_field() example


$query = $db->simple_select(TABLE_PREFIX."settings", "*", 
"name='boardclosed_reason'", array("order_by" => 'name', 
"order_dir" => 'name', "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>";

This page was last modified 23:35, 12 October 2007.