Hi All,

I am having an issues with an SQL query and I can't quite work out how to resolve it.

I have searched Google for the answer but can't seem to find the solution there either.

Basically I have a database andin one of the tables it has a start date column and an end date column.

I have a form that you input the start date and end date range you want to search the database for and display the results.

My issues is with getting the dates that are inputted on the form to display on the SQL results page.

I have tried the following code:

$sql = "SELECT * FROM table
WHERE Start >= '2020-01-01' AND End <= '2020-02-02'
Order By colour DESC";

and this works for the given dates specified above.

I have also tried changing it to the following but this didn't work

$sql = "SELECT * FROM table
WHERE Start >= '$start_date' AND End <= '$end_date'
Order By color DESC";

Thank you in advanced for your help.

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.