php - Trying to get month & year from timestamp in mysql table -
$stfeeres = mysql_query("select * student inner join stledger on student.stid = stledger.stid student.status='active' , date('m-y', strtotime(stledger.entrytime))=date('m-y')");
i trying month , year. entrytime timestamp in table. please me.
i getting error
warning: mysql_fetch_array() expects parameter 1 resource
try so:
select * `student` month(entrytime)=month('2017-08-18') , year(entrytime)=year('2017-08-18')
than mysql month "08" , year "2017".
edit:
$yourdate='2017-08-18'; // or date('y-m-d'); $stfeeres = mysql_query("select `stledger`.entrytime student inner join stledger on student.stid = stledger.stid student.status='active' , month(stledger.entrytime)=month({$yourdate}) , year(stledger.entrytime)=year({$yourdate})");
and not use mysql_*
use instead mysqli_*
.
Comments
Post a Comment