function _id_by_name in Bibliography Module 6
Same name and namespace in other branches
- 7 biblio.install \_id_by_name()
- 7.2 biblio.install \_id_by_name()
1 call to _id_by_name()
File
- ./
biblio.install, line 1255 - Install file for biblio module
Code
function _id_by_name($table, $name, $id = NULL, $build = NULL) {
static $result = NULL;
if (!empty($build)) {
//refresh cache from table
unset($result[$build['tablename']]);
$res = db_query("SELECT " . $build['name_column'] . ", " . $build['id_column'] . " FROM {" . $build['tablename'] . "}");
while ($row = db_fetch_array($res)) {
$result[$build['tablename']][$row[$build['name_column']]] = $row[$build['id_column']];
}
return;
}
$name = trim($name);
if (isset($result[$table][$name])) {
return $result[$table][$name];
}
if ($id) {
$result[$table][$name] = $id;
}
return FALSE;
}