Jump to content

Recommended Posts

First off, I apologize, I?ve never used a forum for help before and I appreciate any help you guys can give me.

 

Script Info

This script should be collecting data for each user and how many accounts they have opened up.

Then it should figure out what office they belong to.

Then give a total amount of accounts opened per office.

This is the general goal.

    $thismonthFull = date("F", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
    $thismonth = date("m", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
    $thisyear = date("Y");
    $START = "$thisyear-$thismonth-01";
    $END = "$thisyear-$thismonth-31";

    $query = mysql_query("SELECT * FROM `API` WHERE `ApprovalDate`>='$START' AND `ApprovalDate`<='$END'");
    while($row = mysql_fetch_array($query)){
       $ApprovalDate = $row['ApprovalDate'];
       $SalesRepFName = $row['SalesRepFName'];
       $SalesRepLName = $row['SalesRepLName'];
       trim($SalesRepFName);
       trim($SalesRepLName);
       $SalesRepName = "$SalesRepFName $SalesRepLName";
       $OfficeNum = $row['OfficeNum'];
       $MerchantNumber = $row['MerchantNumber'];
       
       if($Stats[$SalesRepName] != NULL){
          $Count = (int)$Stats[$SalesRepName];
          $Count++;
          $Stats[$SalesRepName]="$Count";
       }
       else{
          $Stats[$SalesRepName]=1;
       }
       $Total++;
    }

    $query = mysql_query("SELECT * FROM `Users`");
    while($row = mysql_fetch_array($query)){
       $UID = $row['UID'];
       $AgentFname = $row['Fname'];
       $AgentLname = $row['Lname'];
       trim($AgentFname);
       trim($AgentLname);
       $AgentName = "$AgentFname $AgentLname";
       $OfficeID = $row['OfficeID'];
       $AgentsOffice['$AgentName'] = "$OfficeID";
    }

    $query = mysql_query("SELECT * FROM `Office_List`");
    while($row = mysql_fetch_array($query)){
       $ID = $row['ID'];
       $City = $row['City'];
       $State = $row['State'];
       $OwnerID = $row['OwnerID'];
       $Vanity[$ID] = $row['Vanity'];
       $Status = $row['Status'];
       $OfficeList[$ID] = "$City, $State";
    }

    foreach($Stats as $key => $value){
       $Office = $AgentsOffice['$key'];
       $Count = $OfficeStats['$Office'];
       $OfficeStats['$Office'] = $Count + $value;
    }

    foreach($OfficeStats as $key => $value){
       $Office = $OfficeList[$key] . " " . $Vanity[$key];
       echo "$Office $value<br />"; //Office reports blank and the value is reporting the total accounts opened.
    }

 

Thanks again for any help!

Link to comment
https://forums.phpfreaks.com/topic/268583-arrays-seem-to-break/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.