db_result
Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.
includes/database.mysql.inc, строка 174
- Версии
- 5
db_result($result,
$row= 0)- 6
db_result($result)
Возвращает одиночное поле результата из предыдущего запроса.
Используйте эту функцию, для получения результата запроса с единичным полем (например SELECT nid FROM...
или SELECT COUNT(*) FROM...
), иначе используйте db_fetch_object()
или db_fetch_array()
.
Параметры
$result
Ресурс результата запроса к базе данных, который возвращает db_query()
.
Возвращаемое значение
Поле результата или FALSE
.
Return an individual result field from the previous query.
Only use this function if exactly one field is being selected; otherwise, use db_fetch_object() or db_fetch_array().
Parameters
$result A database query result resource, as returned from db_query().
Return value
The resulting field or FALSE.
Связанные темы
- Уровень абстракции базы данных
- Позволяет выполнять один программный код на разных СУБД.
▾ 114 функции вызывают db_result()
- actions_function_lookup in includes/actions.inc
- Получая md5 хэш имени функции, возвращает само имя функции.
- aggregator_block in modules/aggregator/aggregator.module
- Реализация hook_block().
- batch_example_batch_1 in developer/examples/batch_example.module
- Batch 1 : Load 100 times the node with the lowest nid
- batch_example_op_2 in developer/examples/batch_example.module
- Batch operation for batch 2 : load all nodes, 5 by five This is a multipart operation, using the
- block_add_block_form_validate in modules/block/block.admin.inc
- block_admin_configure_validate in modules/block/block.admin.inc
- book_block in modules/book/book.module
- Реализация hook_block().
- book_update_6000 in modules/book/book.install
- Drupal 5.x to 6.x update.
- comment_multiple_delete_confirm in modules/comment/comment.admin.inc
- List the selected comments and verify that the admin really wants to delete them.
- comment_new_page_count in modules/comment/comment.module
- Вычисляет номер страницы для первого нового комментария.
- comment_nodeapi in modules/comment/comment.module
- Реализация hook_nodeapi().
- comment_num_all in modules/comment/comment.module
- Возвращает число комментариев к ноде.
- comment_num_new in modules/comment/comment.module
- Получает число новых комментариев для текущего пользователя и указанной ноды.
- comment_num_replies in modules/comment/comment.module
- Возвращает количество ответов на комментарий.
- comment_save in modules/comment/comment.module
- Сохраняет новый или измененный комментарий.
- comment_unpublish_action in modules/comment/comment.module
- Действие; Снимает комментарий с публикации.
- comment_validate in modules/comment/comment.module
- Проверка данных комментария.
- dblog_cron in modules/dblog/dblog.module
- Реализация hook_cron().
- db_check_setup in includes/database.pgsql.inc
- Проверяет, корректно ли настроена база данных.
- db_last_insert_id in includes/database.mysql-common.inc
- Возвращает id последнего вставленного ряда. Можно безопасно использовать в thread safe режиме.
- do_search in modules/search/search.module
- Do a query on the full-text search index for a word or words.
- drupal_get_filename in includes/bootstrap.inc
- Возвращает и опционально устанавливает имя файла системного элемента (модуль, тема, и т.д.). Имя файла, который существует, кеширован или получен из базы данных, возвращается если файл существует.
- drupal_is_denied in includes/bootstrap.inc
- Perform an access check for a given mask and rule type. Rules are usually created via admin/user/rules page.
- drupal_lookup_path in includes/path.inc
- Для указанного синонима пути возвращается системный URL Drupal, если он существует. Для указанного системного URL Drupal возвращается синоним пути, если он существует. В остальных случаях возвращается FALSE.
- file_space_used in includes/file.inc
- Определяет общее дисковое пространство используемое пользователем или всей системой
- filter_admin_format_form_submit in modules/filter/filter.admin.inc
- Process filter format form submissions.
- filter_format_allowcache in modules/filter/filter.module
- Check if text in a certain input format is allowed to be cached.
- filter_list_format in modules/filter/filter.module
- Возвращает список форматов ввода для выбранного формата.
- flood_is_allowed in includes/common.inc
- Check if the current visitor (hostname/IP) is allowed to proceed with the specified event.
- forum_nodeapi in modules/forum/forum.module
- Implementation of hook_nodeapi().
- hook_file_download in developer/hooks/core.php
- Контролирует доступ к файлам при приватном способе загрузки. Кроме того, позволяет указывать HTTP заголовки для файлов.
- hook_search in developer/hooks/core.php
- Определяет пользовательскую функцию поиска.
- hook_update_N in developer/hooks/install.php
- Производит обновление таблиц БД, необходимое для единичного обновления модуля.
- install_verify_drupal in ./install.php
- Verify if Drupal is installed.
- locale_languages_predefined_form_validate in includes/locale.inc
- Validate the language addition form.
- locale_translate_edit_form_submit in includes/locale.inc
- Process string editing form submissions.
- locale_update_6000 in modules/locale/locale.install
- {locales_meta} table became {languages}.
- locale_update_6005 in modules/locale/locale.install
- Change language setting variable of content types.
- menu_delete_menu_confirm in modules/menu/menu.admin.inc
- Build a confirm form for deletion of a custom menu.
- menu_delete_menu_confirm_submit in modules/menu/menu.admin.inc
- Delete a custom menu and all items in it.
- menu_edit_menu_submit in modules/menu/menu.admin.inc
- Submit function for adding or editing a custom menu.
- menu_edit_menu_validate in modules/menu/menu.admin.inc
- Validates the human and machine-readable names when adding or editing a menu.
- menu_enable in modules/menu/menu.module
- Реализация hook_enable().
- menu_link_children_relative_depth in includes/menu.inc
- Находит глубину потомков пункта по отношению к глубине пункта.
- menu_link_save in includes/menu.inc
- Сохраняет ссылку меню.
- menu_nodeapi in modules/menu/menu.module
- Реализация hook_nodeapi().
- multipage_form_example_custom_submit in developer/examples/multipage_form_example.module
- nodeapi_example_nodeapi in developer/examples/nodeapi_example.module
- Реализация hook_nodeapi().
- node_access in modules/node/node.module
- Устанавливает, может ли текущий пользователь выполнять заданные действия над определённой нодой.
- node_access_view_all_nodes in modules/node/node.module
- Determine whether the user has a global viewing grant for all nodes.
- node_admin_nodes in modules/node/node.admin.inc
- Form builder: Builds the node administration overview.
- node_assign_owner_action in modules/node/node.module
- Implementation of a configurable Drupal action. Assigns ownership of a node to a user.
- node_assign_owner_action_form in modules/node/node.module
- node_assign_owner_action_submit in modules/node/node.module
- node_assign_owner_action_validate in modules/node/node.module
- node_comment_mode in modules/node/node.module
- Retrieve the comment mode for the given node ID (none, read, or read/write).
- node_multiple_delete_confirm in modules/node/node.admin.inc
- node_revision_delete_confirm_submit in modules/node/node.pages.inc
- node_search in modules/node/node.module
- Реализация hook_search().
- node_type_delete_confirm in modules/node/content_types.inc
- Menu callback; delete a single content type.
- node_type_save in modules/node/node.module
- Сохраняет тип ноды в базе данных.
- node_update_index in modules/node/node.module
- Реализация hook_update_index().
- openid_association in modules/openid/openid.module
- Attempt to create a shared secret with the OpenID Provider.
- openid_user_add_validate in modules/openid/openid.pages.inc
- openid_user_delete_form in modules/openid/openid.pages.inc
- Present a confirmation form to delete the specified OpenID identity from the system. See alsoopenid_user_delete_form_submit()
- pager_query in includes/pager.inc
- Выполняет «постраничный» запрос к базе данных.
- path_admin_form_validate in modules/path/path.admin.inc
- Verify that a new URL alias is valid
- path_admin_overview in modules/path/path.admin.inc
- Return a listing of all defined URL aliases. When filter key passed, perform a standard search on the given key, and return the list of matching URL aliases.
- path_form_alter in modules/path/path.module
- Реализация hook_form_alter().
- path_nodeapi in modules/path/path.module
- Реализация hook_nodeapi().
- php_install in modules/php/php.install
- Реализация hook_install().
- ping_cron in modules/ping/ping.module
- Реализация hook_cron().
- poll_block in modules/poll/poll.module
- Реализация hook_block().
- profile_autocomplete in modules/profile/profile.pages.inc
- Callback to allow autocomplete of profile text fields.
- profile_category_access in modules/profile/profile.module
- Menu item access callback - check if a user has access to a profile category.
- profile_field_form_validate in modules/profile/profile.admin.inc
- Validate profile_field_form submissions.
- search_update_totals in modules/search/search.module
- This function is called on shutdown to ensure that search_total is always up to date (even if cron times out or otherwise fails).
- sess_count in includes/session.inc
- Количество пользователей, которые имеют сессии. Можно рассчитывать для анонимов или аутентифицированных сессий.
- system_admin_theme_submit in modules/system/system.module
- Process admin theme form submissions.
- system_initialize_theme_blocks in modules/system/system.module
- Assign an initial, default set of blocks for a theme.
- system_install in modules/system/system.install
- Реализация hook_install().
- system_region_list in modules/system/system.module
- Get a list of available regions from a specified theme.
- system_update_6000 in modules/system/system.install
- Remove auto_increment from {boxes} to allow adding custom blocks with visibility settings.
- system_update_6009 in modules/system/system.install
- The PHP filter is now a separate module.
- system_update_6018 in modules/system/system.install
- Add HTML corrector to HTML formats or replace the old module if it was in use.
- system_update_6019 in modules/system/system.install
- Reconcile small differences in the previous, manually created mysql and pgsql schemas so they are the same and can be represented by a single schema structure.
- system_update_6021 in modules/system/system.install
- Migrate the menu items from the old menu system to the new menu_links table.
- system_update_6036 in modules/system/system.install
- Change the search schema and indexing.
- system_update_6041 in modules/system/system.install
- Change forum vocabulary not to be required by default and set the weight of the forum.module 1 higher than the taxonomy.module.
- translation_remove_from_set in modules/translation/translation.module
- Remove a node from its translation set (if any) and update the set accordingly.
- trigger_assign_form_submit in modules/trigger/trigger.admin.inc
- Submit function for trigger_assign_form().
- trigger_assign_form_validate in modules/trigger/trigger.admin.inc
- Validation function for trigger_assign_form().
- trigger_menu in modules/trigger/trigger.module
- Реализация hook_menu().
- upload_delete_revision in modules/upload/upload.module
- upload_save in modules/upload/upload.module
- upload_total_space_used in modules/upload/upload.module
- Определяет, как много дискового пространства занято загруженными файлами.
- user_admin_role_validate in modules/user/user.admin.inc
- user_multiple_delete_confirm in modules/user/user.module
- user_multiple_role_edit in modules/user/user.module
- Callback function for admin mass adding/deleting a user role.
- user_save in modules/user/user.module
- Сохраняет изменения аккаунта пользователя либо добавляет нового пользователя.
- _aggregator_has_categories in modules/aggregator/aggregator.module
- Find out whether there are any aggregator categories.
- _batch_page in includes/batch.inc
- State-based dispatcher for the batch processing page.
- _blogapi_space_used in modules/blogapi/blogapi.module
- _blog_post_exists in modules/blog/blog.module
- Helper function to determine if a user has blog posts already.
- _book_update_outline in modules/book/book.module
- Common helper function to handles additions and updates to the book outline.
- _comment_update_node_statistics in modules/comment/comment.module
- Updates the comment statistics for a given node. This should be called any time a comment is added, deleted, or updated.
- _forum_new in modules/forum/forum.module
- Находит первую непрочтённую ноду для заданного форума.
- _forum_topics_unread in modules/forum/forum.module
- Calculate the number of nodes the user has not yet read and are newer than NODE_NEW_LIMIT.
- _locale_import_one_string_db in includes/locale.inc
- Import one string into the database.
- _menu_find_router_path in includes/menu.inc
- Find the router path which will serve this path.
- _menu_update_parental_status in includes/menu.inc
- Проверяет и обновляет статус 'has_children' для родительской ссылки.
- _node_access_rebuild_batch_operation in modules/node/node.module
- Batch operation for node_access_rebuild_batch.
- _node_revision_access in modules/node/node.module
- _user_edit_validate in modules/user/user.module
Код
<?php
function db_result($result) {
if ($result && mysql_num_rows($result) > 0) {
// The mysql_fetch_row function has an optional second parameter $row
// but that can't be used for compatibility with Oracle, DB2, etc.
$array = mysql_fetch_row($result);
return $array[0];
}
return FALSE;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии