Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:51:20+00:00 2026-05-26T17:51:20+00:00

I have the following class. Which returns certain fields. I am interested in Reference.

  • 0

I have the following class. Which returns certain fields. I am interested in Reference. I want it to split up the data so that after the query is returned reference contains an ‘A’ then return that, if it contains a B return that. seperately so i am able to put it in table show the amount of a’s returned, b’s returned etc. The data is listed by room.

<?php


class CHWIPProgress {

    var $conn;

    // Constructor, connect to the database
    public function __construct() {
        require_once "/var/www/reporting/settings.php";
        define("DAY", 86400);
        if(!$this->conn = mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD)) die(mysql_error());
        if(!mysql_select_db(DB_DATABASE_NAME, $this->conn)) die(mysql_error());
    }

    public function ListWIPOnLocation($location) {
    $sql = "SELECT DISTINCT
            `ProgressPoint`.`PPDescription` AS Description ,`Bundle`.`WorksOrder` AS WorksOrder, `Bundle`.`BundleNumber` AS Reference,`TWOrder`.`DueDate` AS DueDate , `Stock`.`Description` as Stock , `Stock`.`ProductGroup` as Group 
        FROM TWOrder,Bundle,ProgressPoint, Stock
                    WHERE `Bundle`.`CurrentProgressPoint`=`ProgressPoint`.`PPNumber`
        AND `TWOrder`.`Colour`=`Bundle`.`Colour`
        AND `TWOrder`.`Size`=`Bundle`.`Size`
                    AND `TWOrder`.`WorksOrderNumber`=`Bundle`.`WorksOrder`
                    AND `TWOrder`.`Product`=`Stock`.`ProductCode`
                    AND `ProgressPoint`.`PPDescription` = '" . $location . "'
        ORDER BY `TWOrder`.`DueDate` ASC";
        mysql_select_db(DB_DATABASE_NAME, $this->conn);
        $result = mysql_query($sql, $this->conn);
                    $num_rows = mysql_num_rows($result);
                    echo "Number of rows : $num_rows"; 
        while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $return[] = $row;
        }       

        return $return;

    }


}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:51:21+00:00Added an answer on May 26, 2026 at 5:51 pm

    The ListWIPOnLocation function appears to return an array where each item corresponds to a row from the query. You can iterate this array and isolate the items using PHP string functions and perhaps add them other arrays. There is more than one way to arrange the data, here is one example:

    $returned = array();
    $returned["A"] = array();
    $returned["B"] = array();
    foreach($return as $row) {
        if (strpos($row["Reference"], "A") !== FALSE) { // note the !== operator
            $returned["A"][] = $row;
        }
        if (strpos($row["Reference"], "B") !== FALSE) { // note the !== operator
            $returned["B"][] = $row;
        }
    }
    var_dump($returned);
    

    Alternately, You can use the MySQL LIKE operator in the WHERE clause to retrieve the rows where the reference column contains a specific character:

    WHERE ... AND Reference = LIKE '%A%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a domain data model which returns a class such as the following:
Let's say you have a class called Customer, which contains the following fields: UserName
I have following class that returns number of current Request per Second of IIS.
I have the following class which uses BinaryReader internally and implements IDisposable. class DisposableClass
I have the following class which handles my user logged in / logged out
I have the following tricky problem: I have implemented a (rather complicated) class which
Let's say I have the following class hierarchy: TaskViewer inherits from ListViewer<Task> which in
I have a class which has the following constructor public DelayCompositeDesigner(DelayComposite CompositeObject) { InitializeComponent();
I have a class which loads an xml file using the following: Path.Combine( AppDomain.CurrentDomain.BaseDirectory,
I have a DirectoryMonitor class which works on another thread. It has the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.