www.webdeveloper.com
Results 1 to 2 of 2

Thread: if query doesn't work go back a month

  1. #1
    Join Date
    Oct 2004
    Posts
    63

    if query doesn't work go back a month

    I think the best way to show you what I'm trying to achieve is to show you my current attempt:

    PHP Code:
    $month date('m');
    $year date('Y');
    $thisMonth "$year-$month-01 00:00:00";
    $next_month date('m'strtotime('+1 month'));
    $nextMonth "$year-" . ($next_month) . "-01 00:00:00";    

    $data_published_vars fetch_data_pblshd_blog($page_id$thisMonth$nextMonth);

    $a='0';

    while (!(
    is_array($data_published_vars)))
    {
    $this_month date('m'-$astrtotime('-1 month'));
    $thisMonth "$year-" . ($this_month) . "-01 00:00:00";
    $data_published_vars fetch_data_pblshd_blog($page_id$thisMonth$nextMonth);
    $a=$a+1;

    It appears that Month 01 takeaway 1 = 0 when I need it to equal 12. (And actually I suspect I'll get into the same trouble when adding one month to month 12.

    Anyway.... any ideas/help?

    Simon

  2. #2
    Join Date
    Oct 2004
    Posts
    63

    Sorted!

    Sorted!

    PHP Code:
    $month date('m');
    $year date('Y');
    $thisMonth "$year-$month-01 00:00:00";
    $next_month date('m'strtotime('+1 month'));
    $nextMonth "$year-" . ($next_month) . "-01 00:00:00";    

    $data_published_vars fetch_data_pblshd_blog($page_id$thisMonth$nextMonth);

    $a='1';
    while (!(
    is_array($data_published_vars)))
    {
    $this_month mktime(000date("m")-$adate("d"),  date("Y"));
    $thisMonth date('Y-m'$this_month)."-01 00:00:00";
    $data_published_vars fetch_data_pblshd_blog($page_id$thisMonth$nextMonth);
    $a=$a+1;

    Simon Duncan
    BusyView

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles