Eco-$mart Web Site Administration
$dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1');
mysql_select_db('ecosmar_website', $dbcnx);
$checkem = mysql_query("SELECT Category from webfeed ORDER BY Category");
if(!$checkem){
$airs[]="Could not get categories. Error: ".mysql_error();
}else{
while($row=mysql_fetch_array($checkem)){
$cats[]=$row[0];
}//while
$plaincats=array_unique($cats);
}//checkedem
foreach($plaincats as $value){
$IDs=array();
$Categorys=array();
$Products=array();
$Descriptions=array();
$Prices=array();
$Units=array();
$Mins=array();
$Image_Names=array();
$Image_Qtys=array();
$Statuss=array();
$Updates=array();
echo("
" .
"$value |
");
$getem=mysql_query("SELECT ID,Category,Product,Description,Price,Unit,Min,Image_Name,Image_Qty,Status,dtnum FROM webfeed WHERE Category='$value' ORDER BY Product");
if(!$getem){
$airs[]="Could not get product list. Error: ".mysql_error();
}else{
while($row = mysql_fetch_array($getem)){
$ID=$row['ID'];
$Category=$row['Category'];
$Product=$row['Product'];
$Description=$row['Description'];
$Price=$row['Price'];
$Unit=$row['Unit'];
$Min=$row['Min'];
$Image_Name=$row['Image_Name'];
$Image_Qty=$row['Image_Qty'];
$Status=$row['Status'];
$dtnum=$row['dtnum'];
if($Category==$Product){
$cID=$ID;
$cProduct=$Product;
$cDescription=substr($Description, 0, 40);
$cImage_Name=$Image_Name;
$cStatus=$Status;
$cdtnum=$dtnum;
$chunk_due = chunk_split($cdtnum, 2, ":");
$chunk_arrd = explode(":", $chunk_due);
$cupdate = $chunk_arrd[2]."/".$chunk_arrd[3]."/".$chunk_arrd[0].$chunk_arrd[1];
}else{//CATEGORY DOES NOT EQUAL PRODUCT
$IDs[]=$ID;
$Categorys[]=$Category;
$Products[]=$Product;
$Descriptions[]=substr($Description, 0, 40);
$Prices[]=$Price;
$Units[]=$Unit;
$Mins[]=$Min;
$Image_Names[]=$Image_Name;
$Image_Qtys[]=$Image_Qty;
$Statuss[]=$Status;
$chunk_due = chunk_split($dtnum, 2, ":");
$chunk_arrd = explode(":", $chunk_due);
$update = $chunk_arrd[2]."/".$chunk_arrd[3]."/".$chunk_arrd[0].$chunk_arrd[1];
$Updates[]=$update;
}//category is not product
}//while fetching row
echo(" " .
" | " .
" | ID" .
" | Product Name" .
" | Description" .
" | Price" .
" | Unit" .
" | Min" .
" | Image" .
" | QTY" .
" | Status" .
" | Updated" .
" |
" .
"" .
" " .
" | " .
"" .
" " .
" | $cID" .
" | $cProduct" .
" | $cDescription" .
" | " .
" | " .
" | " .
" | " .
"" .
" " .
" | " .
" | $cStatus" .
" | $cupdate" .
" |
");
$i=0;
$counts=count($IDs);
while($i<$counts){
echo("" .
" " .
" | " .
"" .
" " .
" | $IDs[$i]" .
" | $Products[$i]" .
" | $Descriptions[$i]" .
" | $Prices[$i]" .
" | $Units[$i]" .
" | $Mins[$i]" .
" | " .
"" .
" " .
" | $Image_Qtys[$i]" .
" | $Statuss[$i]" .
" | $Updates[$i]" .
" |
");
$i=$i+1;
}//whilst counting down IDs
}//gotem
echo("
");
}//for each unique category
?>
if(!empty($airs)){
foreach($airs as $value){
echo("$value
");
}//4each
}//airs is not empty
?>