Results 1 to 3 of 3
  1.    #1  
    How do you check if the results of an SQL query returned no rows ?

    I have the following code:

    Code:
    if (results.rows.length > 0)
    which works as long as there are rows returned. However, if there are no rows returned at all then both the if and the next part of the statement do not get executed. Assuming because the results are null/empty.

    There must be a way to check this.

    TIA.
  2. #2  
    This same condition works when I use it. I have a SQL transaction success handler that raises a custom event with a boolean parameter based on just this condition.

    Is your SQL transaction returning a failure or is your results.rows just null? It sounds like you have problems somewhere in your code because that if statement should work.

    You should post the code of your transaction success handler if you want more specific help.
  3.    #3  
    Thanks. It was actually a problem with the SQL Got it square away though

Posting Permissions