sending a sql query through ajax, when the sql is contained in a field, and has CURRENT DATE()












0















I have a button, that when you click on, it passes through the current sql query. However it seems that if I have CURRENT DATE() in the query, then I think the () are creating an issue.



FORM



<input type="button" id="projects_more" data-limit="5" data-start="5" data-filter="SELECT * FROM crm_todo WHERE todo_duedate < CURRENT_DATE() ORDER BY todo_duedate DESC" value="show more">


JQUERY



$('#projects_more').click(function(){
limit = $(this).attr('data-limit');
start = $(this).attr('data-start');
filter = $(this).attr('data-filter');
$(this).after('<div id="preloader_rows"></div>');
$.ajax({
type : 'POST',
url : '//'+base_url+'/ajax/projects-pagination.php',
dataType : 'json',
data : 'limit='+limit+'&start='+start+'&filter='+filter,
success : function(data) {
$('#preloader_rows').remove();
$('#projects_more').attr('data-start',data.start);
$('#projects_table').append(data.projects);
if(data.count=='all') $('#projects_more').hide();
}
});
});


The query is passed in through $_POST, and when it gets to the projects-pagination.php, the query doesnt execute. How can I pass the () through?










share|improve this question























  • I don't know your php code, but if you think () in CURRENT_DATE() causing an error, replace it in your input with current_date and in your projects-pagination.php replace current_date with CURRENT_DATE()

    – Abdulsattar Alkhalaf
    Nov 23 '18 at 1:25
















0















I have a button, that when you click on, it passes through the current sql query. However it seems that if I have CURRENT DATE() in the query, then I think the () are creating an issue.



FORM



<input type="button" id="projects_more" data-limit="5" data-start="5" data-filter="SELECT * FROM crm_todo WHERE todo_duedate < CURRENT_DATE() ORDER BY todo_duedate DESC" value="show more">


JQUERY



$('#projects_more').click(function(){
limit = $(this).attr('data-limit');
start = $(this).attr('data-start');
filter = $(this).attr('data-filter');
$(this).after('<div id="preloader_rows"></div>');
$.ajax({
type : 'POST',
url : '//'+base_url+'/ajax/projects-pagination.php',
dataType : 'json',
data : 'limit='+limit+'&start='+start+'&filter='+filter,
success : function(data) {
$('#preloader_rows').remove();
$('#projects_more').attr('data-start',data.start);
$('#projects_table').append(data.projects);
if(data.count=='all') $('#projects_more').hide();
}
});
});


The query is passed in through $_POST, and when it gets to the projects-pagination.php, the query doesnt execute. How can I pass the () through?










share|improve this question























  • I don't know your php code, but if you think () in CURRENT_DATE() causing an error, replace it in your input with current_date and in your projects-pagination.php replace current_date with CURRENT_DATE()

    – Abdulsattar Alkhalaf
    Nov 23 '18 at 1:25














0












0








0








I have a button, that when you click on, it passes through the current sql query. However it seems that if I have CURRENT DATE() in the query, then I think the () are creating an issue.



FORM



<input type="button" id="projects_more" data-limit="5" data-start="5" data-filter="SELECT * FROM crm_todo WHERE todo_duedate < CURRENT_DATE() ORDER BY todo_duedate DESC" value="show more">


JQUERY



$('#projects_more').click(function(){
limit = $(this).attr('data-limit');
start = $(this).attr('data-start');
filter = $(this).attr('data-filter');
$(this).after('<div id="preloader_rows"></div>');
$.ajax({
type : 'POST',
url : '//'+base_url+'/ajax/projects-pagination.php',
dataType : 'json',
data : 'limit='+limit+'&start='+start+'&filter='+filter,
success : function(data) {
$('#preloader_rows').remove();
$('#projects_more').attr('data-start',data.start);
$('#projects_table').append(data.projects);
if(data.count=='all') $('#projects_more').hide();
}
});
});


The query is passed in through $_POST, and when it gets to the projects-pagination.php, the query doesnt execute. How can I pass the () through?










share|improve this question














I have a button, that when you click on, it passes through the current sql query. However it seems that if I have CURRENT DATE() in the query, then I think the () are creating an issue.



FORM



<input type="button" id="projects_more" data-limit="5" data-start="5" data-filter="SELECT * FROM crm_todo WHERE todo_duedate < CURRENT_DATE() ORDER BY todo_duedate DESC" value="show more">


JQUERY



$('#projects_more').click(function(){
limit = $(this).attr('data-limit');
start = $(this).attr('data-start');
filter = $(this).attr('data-filter');
$(this).after('<div id="preloader_rows"></div>');
$.ajax({
type : 'POST',
url : '//'+base_url+'/ajax/projects-pagination.php',
dataType : 'json',
data : 'limit='+limit+'&start='+start+'&filter='+filter,
success : function(data) {
$('#preloader_rows').remove();
$('#projects_more').attr('data-start',data.start);
$('#projects_table').append(data.projects);
if(data.count=='all') $('#projects_more').hide();
}
});
});


The query is passed in through $_POST, and when it gets to the projects-pagination.php, the query doesnt execute. How can I pass the () through?







jquery sql ajax forms






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 0:54









SourceSource

6432716




6432716













  • I don't know your php code, but if you think () in CURRENT_DATE() causing an error, replace it in your input with current_date and in your projects-pagination.php replace current_date with CURRENT_DATE()

    – Abdulsattar Alkhalaf
    Nov 23 '18 at 1:25



















  • I don't know your php code, but if you think () in CURRENT_DATE() causing an error, replace it in your input with current_date and in your projects-pagination.php replace current_date with CURRENT_DATE()

    – Abdulsattar Alkhalaf
    Nov 23 '18 at 1:25

















I don't know your php code, but if you think () in CURRENT_DATE() causing an error, replace it in your input with current_date and in your projects-pagination.php replace current_date with CURRENT_DATE()

– Abdulsattar Alkhalaf
Nov 23 '18 at 1:25





I don't know your php code, but if you think () in CURRENT_DATE() causing an error, replace it in your input with current_date and in your projects-pagination.php replace current_date with CURRENT_DATE()

– Abdulsattar Alkhalaf
Nov 23 '18 at 1:25












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439516%2fsending-a-sql-query-through-ajax-when-the-sql-is-contained-in-a-field-and-has%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439516%2fsending-a-sql-query-through-ajax-when-the-sql-is-contained-in-a-field-and-has%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Paul Cézanne

UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

Angular material date-picker (MatDatepicker) auto completes the date on focus out