Array help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ZMAN

    Array help

    Hello all!

    Going Nuts with this array.
    My goal is to have a time system report on delinquent time that looks like
    this.

    Tom Doe
    Tom@workplace.c om.

    Entered: 0
    Hour(s) on: 2005-02-02

    Entered: 0
    Hour(s) on: 2005-02-01

    *************** **

    Jane Doe
    jane@workplace. com.

    Entered: 0
    Hour(s) on: 2005-02-02

    Entered: 0
    Hour(s) on: 2005-02-03
    [color=blue][color=green][color=darkred]
    >>>>>>>>>>>>>>> >>>>>>>[/color][/color][/color]

    What I'm getting is this

    Jane@workplace. com.
    You have entered insufficient time on:
    Employee: Jane Doe
    Entered: 0
    Hour(s) on: 2005-02-01


    Tom@workplace.c om.
    You have entered insufficient time on:
    Employee: Tom Doe
    Entered: 0
    Hour(s) on: 2005-02-01


    Harry@workplace .com.
    You have entered insufficient time on:
    Employee: Harry Doe
    Entered: 0
    Hour(s) on: 2005-02-02


    Jane@workplace. com.
    You have entered insufficient time on:
    Employee: Jane Doe
    Entered: 0
    Hour(s) on: 2005-02-02


    Tom@workplace.c om.
    You have entered insufficient time on:
    Employee: Tom Doe
    Entered: 0
    Hour(s) on: 2005-02-02
    [color=blue][color=green][color=darkred]
    >>>>>>>>>>>>>>> >>>>>>>>>>[/color][/color][/color]

    My code after the sql returns is:

    while($row = $result->fetchRow(DB_FE TCHMODE_ASSOC)) {

    $email = $row['EmployeeID'] . "@workplace.com ";

    $firstname=$row['FirstName'];

    $lastname=$row['LastName'];

    $fullname = $row['FirstName'] . " ". $row['LastName'];

    $duration=$row['Duration'];

    $day=$row['_Date'];


    // if they have entered less than 8 hours, push them into
    reporting array

    if ($duration < 8){


    // send report to offending individual

    $individualNoti ce["$email"] = array();
    array_push($ind ividualNotice["$email"], " Employee: " . $fullname, "
    Entered: " . $duration, " Hour(s) on: " . $day, "\n");

    foreach( $individualNoti ce as $email=>$infos )
    {

    echo ' <li><b>'.$email ."</b>.<br />\n";
    echo " You have entered insufficient time on: </li>\n";
    echo " <ul>\n";
    $infos; // sorts the list of info

    foreach( $infos as $info )
    {
    echo $info . '<br>';
    }
    echo " </ul>\n";



    }

    echo "</ol>\n";

    }

    Any help would be greatly appreciated.
    Thanks in advance!
    BZ





  • Chung Leong

    #2
    Re: Array help


    "ZMAN" <vze2mf4r@veriz on.net> wrote in message
    news:VUTOd.2467 2$uc.17602@trnd dc09...[color=blue]
    > Hello all!
    >
    > Going Nuts with this array.
    > My goal is to have a time system report on delinquent time that looks like
    > this.
    >
    > Tom Doe
    > Tom@workplace.c om.
    >
    > Entered: 0
    > Hour(s) on: 2005-02-02
    >
    > Entered: 0
    > Hour(s) on: 2005-02-01
    >
    > *************** **
    >
    > Jane Doe
    > jane@workplace. com.
    >
    > Entered: 0
    > Hour(s) on: 2005-02-02
    >
    > Entered: 0
    > Hour(s) on: 2005-02-03
    >[/color]

    Use an ORDER BY clause to sort the results from the query by name first,
    then print out the name/email only when it's different from the current one.


    Comment

    Working...