search

Home  >  Q&A  >  body text

php - How to process data extracted through mysql statements separately

You can get the data after mysql execution through the following code in html

$sql = "SELECT MAX(yj), AVG(yj), Min(yj) FROM " . $this->get_table('item') . ' where category_id = ' . intval($category_id);
<?php 
$biuuu = $this->avgprice;
$pr = (implode('',$biuuu));
$prr = floor($pr);
echo $prr;
?>

Results in 1136922

How to divide the results like this

The maximum value is 113, the average is 69, and the minimum value is 22

PHPzPHPz2790 days ago369

reply all(1)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-16 13:00:53

    First change the sql

    SELECT MAX(yj) as m_max, AVG(yj) as m_avg, Min(yj) as m_min FROM " . $this->get_table('item') . ' where category_id = ' . intval($category_id);

    reply
    0
  • Cancelreply