Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6090651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:14:17+00:00 2026-05-23T12:14:17+00:00

I have an html5 query that works fine like this: tx.executeSql(‘SELECT * FROM bdreminders

  • 0

I have an html5 query that works fine like this:

tx.executeSql('SELECT * 
                 FROM bdreminders
                WHERE firstname = IFNULL(?, firstname) 
                  AND lastname =  IFNULL(?, lastname) 
                  AND baughtgift = IFNULL(?, baughtgift) 
             ORDER BY firstname asc',
              [passedfn,passedln,passedbg],renderFunc,birthdayapp.onError);

However, I want to use the “like” operator instead of “=” but do not know how to implement it using IFNULL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:14:17+00:00Added an answer on May 23, 2026 at 12:14 pm

    If you simply replace the ‘=’ with a LIKE operator, you will get the same exact match answer as your current query. I assume you would like to use the LIKE operator to do something different (such as a begins with search).

    I provided you how SQL databases normally does this, but if this works for you depends on how SQL compatible the SQL dialect being used by the HTML5 engine is.

    Firstly, it depends on concaternation syntax. Secondly, it depends on concaternation using NULL + string produces NULL or the string. Most professional databases would yield NULL (this is good for you, because then this will work).

    The following should work on MySQL or Oracle and some other databases:

    SELECT * FROM bdreminders
    WHERE firstname LIKE IFNULL( CONCAT(?,'%'), firstname)
    AND lastname LIKE IFNULL( CONCAT(?,'%'), lastname)
    AND baughtgift LIKE IFNULL( CONCAT(?,'%'), baughtgift)
    ORDER BY firstname asc
    

    or (for Oracle, Postgre and others)

    SELECT * FROM bdreminders
    WHERE firstname LIKE IFNULL( ? ||'%', firstname)
    AND lastname LIKE IFNULL( ? || '%', lastname)
    AND baughtgift LIKE IFNULL( ? || '%', baughtgift)
    ORDER BY firstname asc
    

    or (for SQL server and others)

    SELECT * FROM bdreminders
    WHERE firstname LIKE IFNULL( ? +'%', firstname)
    AND lastname LIKE IFNULL( ? + '%', lastname)
    AND baughtgift LIKE IFNULL( ? + '%', baughtgift)
    ORDER BY firstname asc
    

    I would try the last one first. If the above does not work and you get all bdreminders, the database does not concaternate NULL+string to NULL. In this case, I don’t think you can use ISNULL as it will return the first non null value and thus, always return ‘%’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi have a small entry form that is jquery driven. It works fine on
I have a PHP/MySQL query that returns to an HTML table, and I'm stuck
I have a query that is more complicated, but basically creates an HTML page
I have external html5 canvas that you can paint on some lines using your
I have a webapp that export reports in PDF. Everything is fine when the
I have an app that works with an idea of redemption codes (schema: ID,
My javascript reads data from a query string and puts that data into a
I have a category select that then loads up sub categories into a drop
I have this ajax_update script that updates file.php every 60 seconds.. Now file.php outputs
We have a list of dates that is drawn from a MySQL database. That

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.