Newsgroup: it.comp.www.php
Titolo: eliminare elementi array

ho il problema di eliminare alcuni elementi dalla array bidimensionale
$aRows ma non ho idea di come fare e di dove intervenire. La query
interroga un file *.dbf e riporta tutti i campi di un record. Io
dovrei ridurre il numero di campi ai soli desiderati e pensavo di
farlo intervenendo sull'array.
grazie
un saluto a tutti
alberto
/**
 * This function takes the query result set object and processes all
result
 * sets and formats them into a single html table string.
 *
 * @param $oResultSet object - The result set object to read.
 * @return string - An html table of result values.
 **/
 
 
function formatQueryResults( $oResultSet, $aszLayers )
{
    global $gaszWMSResults;
  // initialize the  variables
  $szReturnValue = "";
   $aszNoResults = array();
    // loop through each result set and return
    $nCount = $oResultSet->nNumResults;
 
    for ( $i=0; $i<$nCount; $i++ )
    {
        // process each result set
       $aRows = $oResultSet->getResultSet( $i ); //carica tutte le
colonne
 
 
      // check if single or multiple results were returned
        if ( is_array( $aRows ) )
        { 
            // build title rows
            $szReturnValue .= "<tr>\n";
            $szReturnValue .= "<td>\n";
            $szReturnValue .= "<table bgcolor=\"#999999\"
width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n";
            $szReturnValue .= "<tr>\n";
            $szReturnValue .= "<td colspan=".count($aRows[0])."
bgcolor=\"C1D8E3\"><font face=\"Arial, Helvetica, sans-serif\"
size=\"2\"><u><b>".$aszLayers[$i]."</b></u></font></td>\n";
            $szReturnValue .= "</tr>\n";
            $szReturnValue .= "<tr>\n";
            // loop and use key for titles  (originale)
			          foreach ($aRows[0] as $key => $value)
            {  
               $szReturnValue .= "<td bgcolor=\"E2EFF5\"><font
face=\"Arial, Helvetica, sans-serif\"
size=\"2\">".$key."</font></td>\n";
            }
            $szReturnValue .= "</tr>\n";
 
        // loop through the results and format each row
            foreach ( $aRows as $aRow )
           { 
        // add a row for each
       $szReturnValue .= "<tr>\n";
                // loop and add a cell for each result
                foreach ( $aRow as $xCell )
                {
                $szReturnValue .= "<td bgcolor=\"#ffffff\"><font
face=\"Arial, Helvetica, sans-serif\" size=\"2\">".
$xCell."</font></td>\n";
          }
               $szReturnValue .= "</tr>\n";
          }
            // close the table
            $szReturnValue .= "</table>\n";
            $szReturnValue .= "</td>\n";
            $szReturnValue .= "</tr>\n";
        }
        else
        {
            // check if wms
           if ( substr( $aRows, 0, 26 ) == "No results found for
layer" )
                array_push( $aszNoResults, $aszLayers[$i] );
 
           else
            {
                $nTmpCount = count( $gaszWMSResults );
               $gaszWMSResults[$nTmpCount][0] = $aRows;
                $gaszWMSResults[$nTmpCount][1] = $aszLayers[$i];
            }
        }
    // end loop of layers
    }
 
    // add the list of layer that return no results
  //  $nCountNoResults = count( $aszNoResults );
  //  if ( $nCountNoResults > 0 )
  //  {
    //    $szReturnValue .= "<tr>\n";
    //    $szReturnValue .= "<td>\n";
     //   $szReturnValue .= "<table bgcolor=\"#999999\" width=\"100%\"
border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n";
     // $szReturnValue .= "<tr>\n";
     //   $szReturnValue .= "<td bgcolor=\"#C1D8E3\"><font
face=\"Arial, Helvetica, sans-serif\" size=\"2\"><b>The following
layers did not return any results:</b></font></td>\n";
     //   $szReturnValue .= "</tr>\n";
     // $szReturnValue .= "<tr>\n";
     //   $szReturnValue .= "<td bgcolor=\"E2EFF5\"><font
face=\"Arial, Helvetica, sans-serif\" size=\"2\">";
     //   for ($i=0; $i<$nCountNoResults; $i++)
      //  {
      //      $szReturnValue .= $aszNoResults[$i];
      //      if ( $i < $nCountNoResults - 1) $szReturnValue .= ", ";
      //  }
      //  $szReturnValue .= "</font></td>\n";
       // $szReturnValue .= "</tr>\n";
  //  $szReturnValue .= "</table>\n";
    //    $szReturnValue .= "</td>\n";
     //   $szReturnValue .= "</tr>\n";
   // }
    // return the formated string
  return $szReturnValue;
// end formatQueryResults function
}

 $aRows
http://www.php.net/unset
-- 
I am what I am, I do what I can
L'uomo, conscio di sbagliare, persevera.