如何进行提取过去一个月记录的查询

时间:2016-10-18 03:57:22

标签: php mysql sql

我需要在MySQL中编写一个查询,它会显示过去一个月内添加的所有字段。

 if (isset($_FILES["image_upload"]["name"])) {

        $name = $_FILES["image_upload"]["name"];
        $size = $_FILES["image_upload"]["size"];

        $ext = end(explode(".", $name));
        $allowed_ext = array("png", "jpg", "jpeg", "PNG", "JPG", "JPEG");
        $checkexactlyimage = getimagesize($name);

        $allowedTypes = array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF);
        $detectedType = exif_imagetype($_FILES['image_upload']['tmp_name']);
        $detectedTypeerror = !in_array($detectedType, $allowedTypes);

        if ($detectedTypeerror !== false) {
            echo "Only JPG,PNG and JEPG files are allowed";
        } else if ($check !== false) {
            echo "Only JPG,PNG and JEPG files are allowed";
        } else if (in_array($ext, $allowed_ext)) {
            if ($size < (5000000)) {
                $new_image = '';
                $new_name = md5(rand()) . '.' . $ext;
                $path = '../folder/' . $new_name;
                list($width, $height) = getimagesize($_FILES["image_upload"]["tmp_name"]);
                if ($ext == 'png') {
                    $new_image = imagecreatefrompng($_FILES["image_upload"]["tmp_name"]);
                }

                if ($ext == 'jpg' || $ext == 'JPG' || $ext == 'JPEG' || $ext == 'jpeg') {
                    $new_image = imagecreatefromjpeg($_FILES["image_upload"]["tmp_name"]);
                }

                $new_width = 730;
                $new_height = ($height / $width) * 400;
                $tmp_image = imagecreatetruecolor($new_width, $new_height);
                imagecopyresampled($tmp_image, $new_image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

                imagejpeg($tmp_image, $path, 100);
                imagedestroy($new_image);
                imagedestroy($tmp_image);

                // third get your image
                $image3 = $path;
                $picture3 = base64_encode(file_get_contents($image3));
                $adimageno = 'data:image/gif;base64,' . $picture3 . '"';

                echo '<img src="' . $adimageno . '"  width="300" class="_setup-width-345"/>';

                $ifexistalready = "query";
                $ifexistalreadyqry = mysql_query($ifexistalready);
                $existornot = mysql_fetch_assoc($ifexistalreadyqry);
                $getidofstore = $existornot['ID'];
                $getcvrimage = $existornot['Simage'];

                $updatetable = "query";
                $updatetableqry = mysql_query($updatetable);
                if ($updatetableqry) {
                    unlink('../store-image/' . $getcvrimage);
                } else {
                    echo "Error on uploading image";
                }

            } else {
                echo 'Image File size must be less than 5 MB';
            }
        } else {
            echo 'Only JPG,PNG and JEPG files are allowed';
        }
    } else {
        echo 'Please select a image file';
    }

查询应该提出约翰和理查德今天(18日),但在一周时间(25日),它将自动调整为仅接收理查德,因为它是在一个月前添加的

提前致谢

2 个答案:

答案 0 :(得分:0)

必须检查Route::get('/{any?}', 'PagesController@index')->where('any', '.*'); month

year

答案 1 :(得分:0)

我们一直在搜索,发现这就是这样做的方式

SELECT `Name`, `Date added` 
FROM table WHERE `Date added` > DATE_ADD(CURRENT_DATE(),INTERVAL -1 MONTH)