I Am Unable To Find If The Row Already Exists In Mysql Db Using Time Function In Php Mysql Query?
i am currently working on a module where faculty can post attendance to the students by selecting a dropdown(select box) which is generated dynamically by the information given by
Solution 1:
Your assignment is:
$dis_date=date("Y-m-d H:i:s");
so $dis_date
contains both a date and a time of day. The query will only match if the records in the table have the exact same time of day, not just the same date.
You should leave the time out of the variable:
$dis_date=date("Y-m-d");
If the datatype of the column in the table is DATETIME
, you also need to filter out the time from that, with:
ANDDATE(ondate)='$dis_date'And subject='$subj_d'"
You don't need to do this if the datatype is DATE
.
Post a Comment for "I Am Unable To Find If The Row Already Exists In Mysql Db Using Time Function In Php Mysql Query?"