title: Warning: When only one parameter is given, it must be an array
body: <p>I am trying to select minimum and maximum value for capacity from MySQL table but whenever I try I get the following error:</p>
  
  <blockquote>
    <p>Warning: min(): When only one parameter is given, it must be an array
    in /campus/campus.php on line 38 Call Stack: 0.0003 352296 1. {main}()
    /campus/campus.php:0 0.0124 1654304 2. min() /campus/campus.php:38
    Warning: max(): When only one parameter is given, it must be an array
    in /campus/campus.php on line 39 Call Stack: 0.0003 352296 1. {main}()
    /campus/campus.php:0 0.0125 1654360 2. max() /campus/campus.php:39</p>
  </blockquote>
  
  <p>Here is the code I'm using:</p>
  
  <pre><code>$sql= "SELECT MIN(capacity), MAX(capacity) FROM room";
  
  $res =&amp; $db-&gt;query($sql);
  if (PEAR::isError($res)) {
      die($res-&gt;getMessage());
  }
  
  while($row = $res-&gt;fetchRow())
      {
          $minCapacity = $row[MIN(capacity)];
          $maxCapacity = $row[MAX(capacity)];
      }
  
  echo $minCapacity;
  echo $maxCapacity;
  </code></pre>