2 Column Mysql Date Range Search in PHP

前端 未结 5 579
悲哀的现实
悲哀的现实 2020-12-18 14:57

MySQL column > sdate, edate ( its 2 column).

sdate is start date for project starting and edate is end date for project ending.

so i need to make search betw

5条回答
  •  攒了一身酷
    2020-12-18 15:33

    SELECT project_name, sdate, edate FROM projects WHERE sdate <= $_POST['edate'] AND edate >= $_POST['sdate']

    Gives you any project with start date and end date that overlap the Form start date and end date. (assuming the form sdate and edate are in the right format)

提交回复
热议问题