title: Problem with max SQL function
body: <p>I have this code in PHP</p>
  
  <pre><code>$max="SELECT MAX(num) FROM info";
  $maxquery= mysql_query($max) or die (died);
  while($row = mysql_fetch_array($maxquery)){
      echo "The max num is ". $row['num']."this is it";
  }
  $maxnum= mysql_fetch_array($maxquery);
  echo "&lt;br&gt;".$maxnum."hh";
  </code></pre>
  
  <p>then the output be:</p>
  
  <p>The max num is this is it</p>
  
  <p>hh</p>
  
  <hr>
  
  <p>Why didn't the query get the max number?</p>
  
  <p>The table is called <code>info</code> and it has these fields, ID, num, title, description, and answer.</p>
  
  <hr>
  
  <p>After editing:</p>
  
  <p>I tried my query in MySQL and it works fine!</p>
  
  <p>"SELECT MAX(num) FROM info"</p>
  
  <p>and this is my complete code if it can help:</p>
  
  <pre><code>&lt;?php
      $answer=$_GET["answerbox"];
      $ID=$_GET["TheID"];
  
      $host="localhost";
      $username="root";
      $password="";
      $db_name="game";
      mysql_connect("$host","$username","$password")or die("cannot connect");
      mysql_select_db("$db_name")or die("cannot select DB");
  
      $max="SELECT MAX(num) FROM info";
      $maxquery= mysql_query($max) or die (died);
      while($row = mysql_fetch_array($maxquery)) {
          echo "The max num is ". $row['num']."this is it";
      }
  
      $maxnum= mysql_fetch_array($maxquery);
      $sql="SELECT * FROM info  WHERE ID=".$ID;
      $query = mysql_query($sql) or die(errorquery);
      $row = mysql_fetch_array($query);
      $trueanswer = $row['Answer'];
      $num=$row['num'];
      if ($num&lt;$maxnum)
      {
          $numto= $num +1 ;
          echo "&lt;br&gt;".$maxnum."hh";
      }
  ?&gt;
  </code></pre>