I am looking for a way to find the highest 5 and lowest 5 numbers within 300
or so numbers. Here is what I have so far...
$Tickers = array();
$Current = array();
// SQL QUERY TO GET TICKERS
MSSQL_CONNECT($HostName,$UserName,$Password);
mssql_select_db($DBName) or DIE("Table unavailable");
$Results = MSSQL_QUERY("SELECT CompanyName,Ticker FROM Company WHERE
Ticker != ''");
$RowCount = MSSQL_NUM_ROWS($Results);
print "$RowCount Number of Tickers<br>\n";
if($RowCount != 0) {
for ($i = 0; $Field = MSSQL_FETCH_ARRAY($Results); ++$i) {
array_push($Tickers, $Field["Ticker"]); }
}
else { print "There was nothing selected in the Query, it may have been
bad."; }
foreach($Tickers as $Ticker) { Get Last price on the ticker from database.
and... array_push($Current, $Value); }
Now that I have the values in an array I would like to pull out the five
highest and the 5 lowest. Is there a way to do that....if not, is there
another way to do what I am looking for. I keep thinking I would have to
compare each ticker against all the others to verify it's standing...and
that seems like a lot of work.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php