2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Provides download to a given field defined in parameters.
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/mime.lib.php';
15 /* Check parameters */
16 PMA_Util
::checkParameters(
21 if (!$GLOBALS['dbi']->selectDb($db)) {
23 sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)),
28 /* Check if table exists */
29 if (!$GLOBALS['dbi']->getColumns($db, $table)) {
30 PMA_Util
::mysqlDie(__('Invalid table name'));
34 $sql = 'SELECT ' . PMA_Util
::backquote($_GET['transform_key'])
35 . ' FROM ' . PMA_Util
::backquote($table)
36 . ' WHERE ' . $_GET['where_clause'] . ';';
37 $result = $GLOBALS['dbi']->fetchValue($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', '');
48 $table . '-' . $_GET['transform_key'] . '.bin',
49 PMA_detectMIME($result),