2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Provides download to a given field defined in parameters.
11 require_once './libraries/common.inc.php';
12 require_once './libraries/mime.lib.php';
14 /* Check parameters */
15 PMA_checkParameters(array('db', 'table', 'where_clause', 'transform_key'));
18 if (!PMA_DBI_select_db($db)) {
19 PMA_mysqlDie(sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)),
23 /* Check if table exists */
24 if (!PMA_DBI_get_columns($db, $table)) {
25 PMA_mysqlDie(__('Invalid table name'));
29 $sql = 'SELECT ' . PMA_backquote($transform_key) . ' FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';';
30 $result = PMA_DBI_fetch_value($sql);
32 /* Check return code */
33 if ($result === false) {
34 PMA_mysqlDie(__('MySQL returned an empty result set (i.e. zero rows).'), $sql);
37 /* Avoid corrupting data */
38 @ini_set
('url_rewriter.tags', '');
41 $table . '-' . $transform_key . '.bin',
42 PMA_detectMIME($result),