提供各式廣告招牌有專業設計規劃及製作團隊
銀行業者共同供應契約廠商,歡迎洽詢
搜尋引擎拆鐵皮屋、拆廠房、大型廢棄物清運
一通電話,馬上為您服務!

首頁  •  tw 論壇 • 程式設計討論     • 

[php] mysql 怎麼 select 出當月資料

房東:阿傅
發表時間:2010-11-06
[檢舉]


php 怎麼 select 出date 當月資料

select * from $table where date=\'\'
例如我只要select 出10月份所以資料
要怎麼寫?






  • 贊助網站       

    廣利不動產-新板特區指名度最高、值得您信賴的好房仲
    您的托付,廣利用心為您服務
    廣利不動產-板橋在地生根最實在--新板特區指名度最高、值得您信賴的好房仲
    完整房訊,房屋、店面熱門精選物件,廣利不動產 優質仲介,房屋租賃、買賣資訊透明,交易真安心!

  • 1 樓住戶:小乖
    發表時間:2010-11-06
    [檢舉]

    試試 FROM_UNIXTIME 

    例 十月

    SELECT * FROM $table WHERE FROM_UNIXTIME(date, '%c') = 10

    例 2010年十月

    SELECT * FROM $table WHERE FROM_UNIXTIME(date, '%Y-%c') = '2010-10'

    2 樓住戶:小強
    發表時間:2010-11-09
    [檢舉]

    if (function_exists('date_default_timezone_set')) {
    date_default_timezone_set('Asia/Chongqing');
    }
    $date = isset($_GET['date']) ? $_GET['date'] : date('Y-m-d');
    $date = getdate(strtotime($date));
    $end = getdate(mktime(0, 0, 0, $date['mon'] + 1, 1, $date['year']) - 1);
    $start = getdate(mktime(0, 0, 0, $date['mon'], 1, $date['year']));
    $pre = date('Y-m-d', $start[0] - 1);
    $next = date('Y-m-d', $end[0] + 86400);
    $html = '';
    $html .= '';
    $html .= '';
    $html .= '';
    $html .= '';
    $html .= '';
    $arr_tpl = array(0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '');
    $date_arr = array();
    $j = 0;
    for ($i = 0; $i < $end['mday']; $i++) {
    if (!isset($date_arr[$j])) {
    $date_arr[$j] = $arr_tpl;
    }
    $date_arr[$j][($i+$start['wday'])%7] = $i+1;
    if ($date_arr[$j][6]) {
    $j++;
    }
    }
    foreach ($date_arr as $value) {
    $html .= '';
    foreach ($value as $v) {
    if ($v) {
    if ($v == $date['mday']) {
    $html .= '';
    } else {
    $html .= '';
    }
    } else {
    $html .= '';
    }
    }
    $html .= '';
    }
    $html .= '
    -' . $date['year'] . ';' . $date['month'] . '+
    ' . $v . '' . $v . ' 
    ';
    echo $html;




    3 樓住戶:阿偉
    發表時間:2010-11-10
    [檢舉]
    ";
    }

    /// Starting of top line showing name of the days of the week

    echo "

    if(isset($prm) and $prm > 0){
    $m=$prm+$chm;}else{
    $m= date("m");}

    $d= date("d"); // Finds today's date
    $y= date("Y"); // Finds today's year

    $no_of_days = date('t',mktime(0,0,0,$m,1,$y)); // This is to calculate number of days in a month

    $mn=date('M',mktime(0,0,0,$m,1,$y)); // Month is calculated to display at the top of the calendar

    $yn=date('Y',mktime(0,0,0,$m,1,$y)); // Year is calculated to display at the top of the calendar

    $j= date('w',mktime(0,0,0,$m,1,$y)); // This will calculate the week day of the first day of the month

    for($k=1; $k<=$j; $k++){ // Adjustment of date starting
    $adj .="
     


    ";

    echo "";

    echo "";

    ////// End of the top line showing name of the days of the week//////////

    //////// Starting of the days//////////
    for($i=1;$i<=$no_of_days;$i++){
    echo $adj."";
    $adj='';
    $j ++;
    if($j==7){echo "";
    $j=0;}

    }

    echo "";
    echo "
    < $mn $yn >
    SunMonTueWedThuFriSat
    $i
    "; // This will display the date inside the calendar cell
    echo "
    ";
    echo "
    ";

    ?>





     共 3 人回應  選擇頁數 【第1 頁】 

    姓名:
    佈告內容: