title: Why the query didn't update after click at the update button?
body: <p>From my previous post (duplicated one - <a href="https://stackoverflow.com/questions/55746381/how-to-edit-update-in-php?noredirect=1#comment98169544_55746381">How to edit &amp; update in php?</a>)</p>
  
  <p><strong>Problem</strong></p>
  
  <p>After I click at the update button (in front.php), the session message is shown but the query didn't update. </p>
  
  <p><strong>What I have tried so far</strong></p>
  
  <p>In <code>edit&amp;update.php</code>, <code>count()</code> is not available after PHP 7.0+.</p>
  
  <p>So I changed into <code>is_countable()</code> but I don't know it is an equivalent/compatible function to <code>count()</code> or not.</p>
  
  <p><strong>Notes</strong></p>
  
  <p>For <code>edit&amp;update.php</code>, I will change into the prepared statement later if the query is able to be updated after clicking at the update button.</p>
  
  <p>There is no warning or notice while running the code but the query didn't update after clicking at the update button. </p>
  
  <p><strong>front.php</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;?php 
  require_once 'edit&amp;update.php';
  include 'connection.php';
  ?&gt;
  &lt;body&gt;
  &lt;!--ID (hidden)--&gt;
  &lt;input type="hidden" name="id" value="&lt;?php echo $id; ?&gt;"&gt;&lt;!--ID--&gt;
  &lt;!--Category--&gt;
  &lt;label&gt;Category&lt;/label&gt;:
  &lt;select name="category" value="&lt;?php echo $category; ?&gt;"&gt;
         &lt;option value="0"&gt;(Please any type below)&lt;/option&gt;
         &lt;option value="A"&gt;A&lt;/option&gt;
         &lt;option value="D"&gt;D&lt;/option&gt;
         &lt;option value="M"&gt;M&lt;/option&gt;
         &lt;option value="S"&gt;S&lt;/option&gt;
         &lt;option value="T"&gt;T&lt;/option&gt;
         &lt;option value="Tr"&gt;Tr&lt;/option&gt;
         &lt;option value="Other"&gt;Other&lt;/option&gt;
  &lt;/select&gt;
  &lt;!--URL--&gt;
  &lt;label&gt;URL&lt;/label&gt;:
  &lt;input type="url" name="url" value="&lt;?php echo $url; ?&gt;" placeholder="URL (www.)" required&gt;
  &lt;!--Issued date--&gt;
  &lt;label&gt;Issued date:&lt;/label&gt;&lt;br&gt;
  &lt;input type="datetime-local" name="datetime" value="&lt;?php echo $datetime; ?&gt;" required&gt;
  &lt;!--Latitude--&gt;
  &lt;label&gt;Latitude&lt;/label&gt;:
  &lt;input type="text" value="&lt;?php echo $lat; ?&gt;" name="lat" placeholder="Latitude"&gt;
  &lt;!--Longitude--&gt;
  &lt;label&gt;Longitude&lt;/label&gt;:&amp;nbsp
  &lt;input type="text" value="&lt;?php echo $lng; ?&gt;" name="lng" placeholder="Longitude"&gt;
  
  &lt;div class="row" style="padding: 10px"&gt;
      &lt;div class="col"&gt;
          &lt;?php if($update == true):
          ?&gt;
          &lt;button type="submit" name="Update"&gt;Update&lt;/button&gt;
          &lt;?php else: ?&gt;
          &lt;button type="submit" name="Save"&gt;Save&lt;/button&gt;
          &lt;?php endif ?&gt;
      &lt;/div&gt;
      &lt;div class="col"&gt;
          &lt;button type="reset" value="Reset"&gt;Reset&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>edit&amp;update.php</strong></p>
  
  <pre><code>&lt;?php
  include 'connection.php';
  
        //Default
        $id=0;
        $update = false;
        $category = '';
        $url = '';
        $datetime = '';
        $lat = '';
        $lng = '';
  
  if (isset($_GET['id']))
        {
            $id = $_GET['id'];
            $update = true;
            $sql = "SELECT * FROM crimenews WHERE crimenews_id=$id";
            $query = mysqli_query($conn,$sql);
  
            if(mysqli_num_rows($query) == 1)
            {
                $row = mysqli_fetch_array($query);
                $category = $row['crimenews_cat'];
                $url = $row['crimenews_url'];
                $datetime = $row['crimenews_datetime'];
                $lat = $row['crimenews_locationLat'];
                $lng = $row['crimenews_locationLong'];
            }
        }
    if (isset($_POST['Update']))
        {
            $id = $_POST['id'];
            $category = mysqli_real_escape_string($conn,$_POST['category']);
            $url = mysqli_real_escape_string($conn,$_POST['url']);
            $datetime = mysqli_real_escape_string($conn,$_POST['datetime']);
            $lat = mysqli_real_escape_string($conn,$_POST['lat']);
            $lng = mysqli_real_escape_string($conn,$_POST['lng']);
  
            $conn-&gt;query("UPDATE crimenews SET crimenews_cat='$category', crimenews_url='$url', crimenews_datetime='$datetime', crimenews_locationLat='$lat', crimenews_locationLong='$lng' WHERE crimenews_id=$id");
  
            $_SESSION['message'] = "This news has updated";
            $_SESSION['msg_type'] = "warning";
  
            header('location: front.php');
          }
  </code></pre>