From eb0e019fa6750fc0cb696a555df832b8ee94b269 Mon Sep 17 00:00:00 2001 From: ninadsp Date: Wed, 30 Jun 2010 01:18:47 +0530 Subject: [PATCH] Rudimentary script in place for retreiving SQL query results by ajax, and paginating the results table in place. --- js/sql.js | 33 +++++++++++++++++++++++++-------- sql.php | 5 +++++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/js/sql.js b/js/sql.js index b5c2e4577..c35d5718e 100644 --- a/js/sql.js +++ b/js/sql.js @@ -5,14 +5,31 @@ * @version $Id$ */ -$("#sqlqueryform").live('submit', function(event) { - event.preventDefault(); +$(document).ready(function() { + + //SQL Query Submit + $("#sqlqueryform").live('submit', function(event) { + event.preventDefault(); - PMA_ajaxShowMessage(); + PMA_ajaxShowMessage(); - $(this).append(''); + $(this).append(''); - $.post($(this).attr('action'), $(this).serialize() , function(data) { - $("#sqlqueryresults").html(data); - }) -}) + $.post($(this).attr('action'), $(this).serialize() , function(data) { + $("#sqlqueryresults").html(data); + }) + }) // end SQL Query submit + + //Paginate the results table + $("input[name=navig]").live('click', function(event) { + event.preventDefault(); + + var the_form = $(this).parent("form"); + + $(the_form).append(''); + + $.post($(the_form).attr('action'), $(the_form).serialize(), function(data) { + $("#sqlqueryresults").html(data); + }) + })// end Paginate results table +}) \ No newline at end of file diff --git a/sql.php b/sql.php index 60da5efd6..f29a81e47 100755 --- a/sql.php +++ b/sql.php @@ -532,6 +532,11 @@ if (0 == $num_rows || $is_affected) { $goto = PMA_securePath($goto); // Checks for a valid target script $is_db = $is_table = false; + + if( $GLOBALS['is_ajax_request'] == true) { + PMA_ajaxResponse($message); + } + include 'libraries/db_table_exists.lib.php'; if (strpos($goto, 'tbl_') === 0 && ! $is_table) { if (strlen($table)) {