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;
}
}
?>