html - Find year high and year low in mysql php -


i have database many records (major columns date, company names, closing price. want achieve use php display unique company names in first column, recent price in 2nd (using date), highest price of unique companies in database in 3rd column , lowest price of unique companies in database. please, how can achieve this?

$query      =   "select date, company, min(close), max (close) pricelist   group company"; $result     =   mysql_query($query); $num_rows   =   mysql_num_rows($result);  ($i=0;$i<$num_rows;$i++){     $id         =   mysql_result($result,$i,"id");     $date       =   mysql_result($result,$i,"date");     $company    =   mysql_result($result,$i,"company");     $close      =   mysql_result($result,$i,"close");     echo "<tr bgcolor=\"#d7dde3\"><td align=right class=no_text>".$company."</td><td align=right class=norm_text>".number_format($close, 2, '.', ',')."&nbsp;</td><td align=right class=norm_text>".$date."&nbsp;</td></tr>"; } 

here trying achieve:

 company name year high date       year low date   google       $20       02/17/2014 $10      05/13/2014   apple        $40       01/22/2014 $34      04/05/2014 

select records date, use php arrays, asort() - low->high, arsort() - high->low.

find more php array here: php array sorting


Comments

Popular posts from this blog

C# random value from dictionary and tuple -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -