title: How to do the AutoIncrement ID in PHP ajax
body: <p>I am creating a simple crud system. I can increment the ID it working well stating from 0001. but I need to start from CS0001 I don't know how to do the task</p>
  
  <pre><code>&lt;?php
  $servername = "localhost";
  $username = "root";
  $password = "";
  $dbname = "loyalhospital";
  
  $conn = new mysqli($servername, $username, $password, $dbname);
  
  if ($conn-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
  }
  
  $query = "SELECT MAX(cast(patientno as decimal)) id FROM patient ";
  if($result = mysqli_query($conn,$query))
  {
     $row = mysqli_fetch_assoc($result);
     $count = $row['id'];
     $count = $count+1;
     $code_no = str_pad($count, 6, "CS0", STR_PAD_LEFT);
     echo json_encode($code_no);
  }
  ?&gt;
  </code></pre>
  
  <p>after add the data ID is not incremented when I run the code output displayed like this <strong>CS04</strong></p>