Saqib Raza
Saqib Raza

Reputation: 3

Selecting dates and showing results in PHP

I have a table called "reservations" containing columns

id
serviceID
dateCreated
name
email
phone
comments

I want to that user can select date from "dateCreated" (dropdown) and then show the results. Right now I have this

$tbl_name = "reservations";

"$select = SELECT * FROM `".$tbl_name."` LIMIT 0 , 30";

What should I do?

Upvotes: 0

Views: 34

Answers (1)

Devon Bessemer
Devon Bessemer

Reputation: 35357

You will want to use a WHERE dateCreated = $date where $date equals the user provided date. However, you will want to look at prepared queries to prevent SQL injections from the user input.

Upvotes: 1

Related Questions