title: MySQL query with output to PHP page
body: <p>I am trying to make simple page which will return values from MySQL table, but the problem is that if I want to use condotions in query then it doesn't work.</p>
  
  <p>My PHP page:</p>
  
  <pre><code>    &lt;?php
  $servername = "10.10.10.10";
  $username = "username";
  $password = "password";
  $dbname = "GENERIC_TABLES";
  
  // Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  // Check connection
  if ($conn-&gt;connect_error) {
       die("Connection failed: " . $conn-&gt;connect_error);
  }
  
  $sql = "SELECT WO_NUM+1 from GENERIC_TABLES.WO_NUMBERS ORDER BY WO_NUM DESC limit 1";
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
       // output data of each row
       while($row = $result-&gt;fetch_assoc()) {
           echo "&lt;br&gt; WO Number ". $row["WO_NUM"]. "&lt;br&gt;";
       }
  } else {
       echo "0 results";
  }
  $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>So, WO_NUM column has numbers like 1, 2, 3 etc.
  I want to get the last one + 1
  So if I do like:</p>
  
  <pre><code>$sql = "SELECT WO_NUM from GENERIC_TABLES.WO_NUMBERS ORDER BY WO_NUM DESC limit 1";
  </code></pre>
  
  <p>Then it works fine, but if I want to make it WO_NUM + 1 then it returns nothing.</p>
  
  <p>Why it happens like that and is there any way to get what I want using MySQL?
  I don't want to get WO_NUM and then using PHP make it + 1, since I also need INSERT to the table values and I would like to understand why it doesn't work.</p>