Commit d8816043 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Fixed documentation for get_field and get_column, and re-ordered get_field

to keep it grouped with get_field_sql
parent 2010703a
......@@ -613,7 +613,7 @@ function get_records_sql_menu($sql,$values=null) {
* Get a single value from a table row where all the given fields match the given values.
*
* @param string $table the table to query.
* @param string $return the field to return the value of.
* @param string $field the field to return the value of.
* @param string $field1 the first field to check (optional).
* @param string $value1 the value field1 must have (requred if field1 is given, else optional).
* @param string $field2 the second field to check (optional).
......@@ -630,11 +630,27 @@ function get_field($table, $field, $field1, $value1, $field2=null, $value2=null,
return get_field_sql('SELECT ' . $field . ' FROM ' . get_config('dbprefix') . $table . ' ' . $select, $values);
}
/**
* Get a single value from a table.
*
* @param string $sql an SQL statement expected to return a single value.
* @return mixed the specified value.
* @throws SQLException
*/
function get_field_sql($sql, $values=null) {
$rs = get_recordset_sql($sql, $values);
if ($rs && $rs->RecordCount() == 1) {
return reset($rs->fields);
} else {
return false;
}
}
/**
* Get a single column from a table where all the given fields match the given values.
*
* @param string $table the table to query.
* @param string $return the field to return the value of.
* @param string $field the field to return the value of.
* @param string $field1 the first field to check (optional).
* @param string $value1 the value field1 must have (requred if field1 is given, else optional).
* @param string $field2 the second field to check (optional).
......@@ -664,22 +680,6 @@ function get_column_sql($sql, $values=null) {
return $db->GetCol($sql, $values);
}
/**
* Get a single value from a table.
*
* @param string $sql an SQL statement expected to return a single value.
* @return mixed the specified value.
* @throws SQLException
*/
function get_field_sql($sql, $values=null) {
$rs = get_recordset_sql($sql, $values);
if ($rs && $rs->RecordCount() == 1) {
return reset($rs->fields);
} else {
return false;
}
}
/**
* Set a single field in every table row where all the given fields match the given values.
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment