Note that there are some explanatory texts on larger screens.

plurals
  1. POChecking to see if a query is not null or an empty string
    primarykey
    data
    text
    <p>I am working on a search function on my website and i am onto doing a next and previous feature, displaying 16 results per page. I have to check if my query isnt null or an empty string however i am no good at if statements as such and i am guessing i have to do one? I am using AJAX for the click functions of next and previous but doing all the calculations in PHP. I guess to do this first query, i have to use an if statement? This is what i have so far.. I don't know which query to check for that is null or an empty string.</p> <p>This is the function i am working on. I am looking to create an if statement to check if query isnt null but unsure how? Any help would be greatly appreciated:</p> <pre><code>public function keywordAction() { $this-&gt;view-&gt;layout()-&gt;disableLayout(); $this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender(TRUE); $session = new Zend_Session_Namespace("keyword"); $search = ""; if(isset($session-&gt;search)) { $search = $session-&gt;search; } if { } } </code></pre> <p>This is the AJAX code i have for the function:</p> <pre><code>$(".paginator").click(function(){ var action = $(this).attr("action"); var page = $("#pageNo").val(); var pageint = parseInt(page); var request = $.ajax({ url : "/support/keyword/", dataType : "JSON", type : "POST", data : { action : action, page : pageint, itemsperpage : parseInt($("#itemsperpage").val()) } }); request.done(function(response){ if(response.error != undefined) { window.location = "/"; } if(response.results != undefined) { $("#output").html(response.results); } if(response.disable != undefined) { if(/1/i.test(response.disable)) { $(this).hide(); } } if(response.undisable != undefined) { if(/1/i.test(response.undisable)) { if(/next/i.test(action)) { $("#previous").show(); } else { $("#next").show(); } } } if(response.resultsstring != undefined) { $("#resultsstring").html(response.resultsstring); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload