add subpackage Selenium to docblock
[phpmyadmin.git] / tbl_get_field.php
bloba537a82d4144725f9c6839238bca1f52b07b07ca
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Provides download to a given field defined in parameters.
6 * @package PhpMyAdmin
7 */
9 /**
10 * Common functions.
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/mime.lib.php';
15 /* Check parameters */
16 PMA_Util::checkParameters(
17 array('db', 'table', 'where_clause', 'transform_key')
20 /* Select database */
21 if (!PMA_DBI_select_db($db)) {
22 PMA_Util::mysqlDie(
23 sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)),
24 '', ''
28 /* Check if table exists */
29 if (!PMA_DBI_get_columns($db, $table)) {
30 PMA_Util::mysqlDie(__('Invalid table name'));
33 /* Grab data */
34 $sql = 'SELECT ' . PMA_Util::backquote($transform_key)
35 . ' FROM ' . PMA_Util::backquote($table)
36 . ' WHERE ' . $where_clause . ';';
37 $result = PMA_DBI_fetch_value($sql);
39 /* Check return code */
40 if ($result === false) {
41 PMA_Util::mysqlDie(__('MySQL returned an empty result set (i.e. zero rows).'), $sql);
44 /* Avoid corrupting data */
45 @ini_set('url_rewriter.tags', '');
47 PMA_downloadHeader(
48 $table . '-' . $transform_key . '.bin',
49 PMA_detectMIME($result),
50 strlen($result)
52 echo $result;