从给定的月份和年份中选择一条记录

时间:2018-08-10 11:46:11

标签: php database

从给定的年份和月份中选择一条记录。我就是这样

if ($_REQUEST['thismonth']!=''){

         $fromdate = $_REQUEST['thismonth']."-01 00:00:00";

         $todate = $_REQUEST['thismonth']."-31 23:59:59";

        $fdate=explode('-',$fromdate);
        //print_r($fdate);

         $year1=$fdate[0];
        $month1=$fdate[1];
        $date = $year1=$fdate[0]."-".$month1=$fdate[1];

$result=mysql_query("select * from tbl_daily_rpt where date like '%$date%' order by cdate desc");

    }
像这样 2017-02-28 在tbl_daily_rpt表中使用

和日期格式。当echo时,给$ date值赋 2017-02 。选择所有日期如下的记录: 2017-02

1 个答案:

答案 0 :(得分:0)

尝试此查询

class TextRobo extends StatefulWidget {

TextRobo1()
{

  createState();
}
  @override
 _TextRoboState createState() => new _TextRoboState();
}

class _TextRoboState extends State<TextRobo> {



 File _imageFile;



 @override
 void initState() {
 // TODO: implement initState
  super.initState();
  _getAndScanImage();

  }

  Future<void> _getAndScanImage() async {
   setState(() {
    _imageFile = null;

  });

  final File imageFile =
  await ImagePicker.pickImage(source: ImageSource.gallery);


 setState(() {
   _imageFile = imageFile;
  });
}

}