How to do the AutoIncrement ID in php ajex : i am crating a simple crud system . i can increment the ID it working well stating from 0001 . but i need start from CS0001 i don't know how to do the task


    <?php
    $servername = "localhost";
    $username = "root";
    $password = "";
    $dbname = "loyalhospital";
    
    $conn = new mysqli($servername, $username, $password, $dbname);
    
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->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);
    }
    ?>

after add the data ID is not incremented when i run the code output displyed like this **CS04**