Jump to content

Recommended Posts

Hi

Thanks for your reply

 

On one of my other pages the user can enter information to search the database in several different textboxes and some drop down menus. For that page I use LIKE and if one of the textboxes hasn’t had information entered it won’t only return the results that have an empty field. This is the code I use for that page:

 

$result = mysql_query("SELECT * FROM Record WHERE Date_of_flight LIKE '%$new_date%' AND Pilot_name LIKE '%$Pilot_name%' AND Take_off_airfield LIKE '%$Take_off_airfield%' AND Arrival_field LIKE '%$Arrival_field%' AND Payment_method LIKE '%$Payment_method%'");

 

For this new page I want to be able to search the database in the same way but be able to search between two dates as well, and if the two dates haven’t been entered it doesn’t return records that have an empty date field.

 

Best wishes

Yogi

 

 

Hi

Thanks for your help

 

But I have now fixed the problem using a series of if statements, it may not be perfect but it gets the job done. ;) I will save your code as it is a much more efficient way of doing what I was trying to accomplish. ;D

 

Best wishes

yogi

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.