Hey,
I'm trying to do a search function that searches for different conditions. One of the conditions is to find all the database matches that are between Year 1 and Year 2 (which the user selected from a dropdown menu). My query is as follows;
$sql = sprintf("SELECT COUNT(parts_id) FROM parts WHERE (parts_model LIKE '%%%s%%') && (parts_condition LIKE '%%%s%%') && (parts_year BETWEEN '%s' AND '%s') ORDER BY parts_name;", $_REQUEST['selModel'], $_REQUEST['selCond'], $_REQUEST['selYear1'], $_REQUEST['selYear2']);
The search results are 0 when it should not be. The query works fine without this section of the code:
&& (parts_year BETWEEN '%s' AND '%s')
The column I am trying to search for is called 'parts_year' and it is stored as 'int' in the database.
Cheers 😃