Jump to content


This topic is now archived and is closed to further replies.



Recommended Posts

Bit of a vague question for someone!  ??? I'm trying to loop some PHP so that it displays a set of results, increases one of the parameters and displays the next set. It needs to stop looping on the 7th pass!

Basically I need it to list todays jobs, then list the next days jobs ... up to a week. I can't just order by date as I need them grouped and not just in a list.

Here's a rough idea of the code but there are lots of errors... could someone point me in the right direction or send me a link to a tutorial.  :)

//sets the day value back to 0 - days run 0,1,2,3,4,5,6,

//sets the initial date to the current date

while ($day < 7)
//not sure if I can write conditions like this!
      $selectdate = date( "Ymd", mktime(0, 0, 0, date("m"), date("d")+$day, date("y")) );
      //increase $startdate by the current value of $day

      if (!$conn)
            {exit("Connection Failed: " . $conn);}
      $sql="SELECT request_id, date FROM assignment WHERE date = '$selectdate'";
      if (!$rs)
            {exit("Error in SQL");}

      echo "$selectdate<br>";

    while (odbc_fetch_row($rs))
          echo "$Request<br>";

$day = ($day +1)
//fairly sure that this won't work as it refers to itself!



Any help would be appreciated as this will remove a load of nearly identical pages.

Share this post

Link to post
Share on other sites

[code=php:0]$day = ($day +1);



Share this post

Link to post
Share on other sites
Thanks Huggiebear! I'll have a play with that and see what I can do.

(It always seems to be you or Wildteen that helps me!)

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.