title: How to assign the result of a SELECT query to a variable?
body: <p>Can't extract the value of the $row['PID'] from the query...</p>
  
  <pre><code>$result = mysqli_query($con,"SELECT * FROM posts WHERE PID=(SELECT max(PID) FROM posts)");
  
  $row = mysql_fetch_array($result);
  
  $id = $row['PID'];
  </code></pre>
  
  <p>I know how to print it out: </p>
  
  <pre><code>while($row = mysqli_fetch_array($result))
        {
        echo $row['PID'];
        }
  </code></pre>
  
  <p>But no idea how to assign it to a variable without having to print it out...</p>