I have a StartDate & EndDate column in the table products my DB
I have a Search Filter on my PHP website which has a Date picker called dpStartDate & dpEndDate.
I need to query my MySQL DB to select records that have
StartDate = or > than dpStartDate
AND
EndDate < or = dpEndDate
I need the PHP code to get the values from the Datepicker Textboxes, Parse the date to the correct format and then create the query based on the values.
Does between act in the same way as
>= and <=
EG:
SELECT product_id FROM jos_vm_product_type_1
WHERE start_date >= '$DEPARTONORAFTER'
AND end_date <= '$RETURNBY'
How would multiple record values be selected from the above query ?
How would i loop through these results in PHP ?
Basically running the below query nested in the loop returning only the DISTINC "parent_prodcut_id" ?
Loop through SelectedValues until EOF
SELECT parent_product_id
from jos_vm_product
WHERE product_id = $CHILDPRODUCTID
end loop
$query = "SELECT product_id FROM jos_vm_product_type_1 WHERE ( start_date BETWEEN '$myStartDate' AND '$myEndDate' ) AND ( end_date BETWEEN '$myStartDate' AND '$myEndDate' )";
Execute the $query
Loop through returned $query records
$query2 = "SELECT distinct parent_product_id from jos_vm_product WHERE product_id = '$query->productid'";
>= and <=
EG:
SELECT product_id FROM jos_vm_product_type_1
WHERE start_date >= '$DEPARTONORAFTER'
AND end_date <= '$RETURNBY'
How would multiple record values be selected from the above query ?
How would i loop through these results in PHP ?
Basically running the below query nested in the loop returning only the DISTINC "parent_prodcut_id" ?
Loop through SelectedValues until EOF
SELECT parent_product_id
from jos_vm_product
WHERE product_id = $CHILDPRODUCTID
end loop
RETURN Distinct "parent_product_id"