diff options
author | Atul Pratap Singh <atulpratapsingh05@gmail.com> | 2013-01-27 19:18:07 +0400 |
---|---|---|
committer | Atul Pratap Singh <atulpratapsingh05@gmail.com> | 2013-01-27 19:18:07 +0400 |
commit | effd5a3cce297617f88accc021b8af32b13234d5 (patch) | |
tree | 2ea701cff8e66652d6eddfe8178d33ae5e0b9c5d /tbl_chart.php | |
parent | fcc51cea40eac1a0118f730c913450f332833eca (diff) |
Show error messages when unable to display chart
Diffstat (limited to 'tbl_chart.php')
-rw-r--r-- | tbl_chart.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tbl_chart.php b/tbl_chart.php index 04505abe7b..ebcccdceed 100644 --- a/tbl_chart.php +++ b/tbl_chart.php @@ -59,6 +59,12 @@ if (isset($_REQUEST['ajax_request']) } $response = PMA_Response::getInstance(); +// Throw error if no sql query is set +if(! isset($sql_query) || $sql_query == '') { + $response->isSuccess(false); + $response->addHTML(PMA_Message::error(__('No SQL query was set to fetch data.'))); + exit; +} $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('chart.js'); @@ -159,6 +165,7 @@ $htmlString = '<script type="text/javascript">' $keys = array_keys($data[0]); $yaxis = -1; +$numeric_fields_present = false; if (count($keys) > 1) { $htmlString .= '<div style="float:left; padding-left:40px;">' . '<label for="select_chartXAxis">' . __('X-Axis:') . '</label>' @@ -190,9 +197,15 @@ if (count($keys) > 1) { . '" selected="selected">' . htmlspecialchars($key) . '</option>'; } + $numeric_fields_present = true; } } + if(! $numeric_fields_present) { + $response->isSuccess(false); + $response->addJSON('message', __('No numeric fields present in the table to plot.')); + exit; + } $htmlString .= '</select>' . '<input type="hidden" name="dateTimeCols" value="'; |